Spin representation in 3D How do you represent $S_x$ and $S_y$ and $S_z$ as a 3D matrix? Can someone explain how $$\left[ J_x,J_y \right] = i\hbar\epsilon_{ijk}J_k,$$  comes out in 3D also? How does it relate to $S_x$ $S_y$ $S_z$? And how can I write $S_x$ and $S_y$ and $S_z$ in Dirac notation in 3D.
Here is the 3D matrix representation for $S_x$ and $S_y$ and $S_z$.
$$S_x=\frac{\hbar}{\sqrt{2}}
  \begin{bmatrix}0 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix}
\\ S_y=\frac{\hbar}{\sqrt{2}}
  \begin{bmatrix}0 & -i & 0 \\ i & 0 & -i \\ 0 & i & 0 \end{bmatrix}
\\ S_z=\hbar
  \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & -1 \end{bmatrix}
\\ H=\hbar^2
  \begin{bmatrix}A & 0 & B \\ 0 & 0 & 0 \\ B & 0 & A \end{bmatrix}
$$
I have asked my teacher through the mail, he said I should use the relation $S_\pm = S_x \pm iS_y$, I think it relates to how to build the $H$ representation for a $$ H =  A S^{2}_z + B(S_x^2 - S_y^2) $$
confused wether $B(S_x^2 - S_y^2)$  gives $B S_z$?
I don't know how I can apply this. I know how I do represent the $S_x$ $S_y$ $S_z$ in 2D. But I just don't know why.
 A: It sounds like what you're asking is: how do you construct a representation of SU(2) in terms of 3x3 matrices on a real 3-dimensional vector space?  (This representation is also known as the "spin-1" representation, as it's used to describe the spin of spin-1 particles.)
The H you mention, which appears to be some kind of Hamiltonian, is irrelevant to the above question.  I assume it is part of a longer homework question which isn't described fully here, so I'll ignore it.
As your teacher mentions, a simple way to construct $S_x$, $S_y$, and $S_z$ is to start with the raising and lowering operators $S_+$ and $S_-$.
If you work in the $S_z$ basis, then you know what the action of $S_z$ is on each of the 3 $S_z$ eigenstates:
$S_z \begin{bmatrix}1 \\ 0 \\ 0 \end{bmatrix} = \hbar \begin{bmatrix}1 \\ 0 \\ 0\end{bmatrix}$
$S_z \begin{bmatrix}0 \\ 1 \\ 0 \end{bmatrix} =  0$
$S_z \begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix} = -\hbar \begin{bmatrix}0 \\ 0 \\ 1\end{bmatrix}$
So the 3x3 matrix form of $S_z$ in this basis must be:
$S_z = \hbar\begin{bmatrix}1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & -1 \end{bmatrix}$
And you also know the actions of the raising and lowering operators on these $S_z$ eigenstates (up to an undetermined constant):
$S_+$ $\begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix} = c\begin{bmatrix}0 \\ 1 \\ 0 \end{bmatrix}$
$S_+$ $\begin{bmatrix}0 \\ 1 \\ 0 \end{bmatrix} = c\begin{bmatrix}1 \\ 0 \\ 0 \end{bmatrix}$
$S_+$ $\begin{bmatrix}1 \\ 0 \\ 0 \end{bmatrix} = 0$
$S_-$ $\begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix} = 0$
$S_-$ $\begin{bmatrix}0 \\ 1 \\ 0 \end{bmatrix} = c\begin{bmatrix}0 \\ 0 \\ 1 \end{bmatrix}$
$S_-$ $\begin{bmatrix}1 \\ 0 \\ 0 \end{bmatrix} = c\begin{bmatrix}0 \\ 1 \\ 0 \end{bmatrix}$
If you take those actions and write them in matrix form, you get:
$S_+$ = c$\begin{bmatrix}0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0\end{bmatrix}$
$S_-$ = c$\begin{bmatrix}0 & 0 & 0 \\ 1 & 0 & 0 \\ 0 & 1 & 0\end{bmatrix}$
Then, you can write down $S_x$ and $S_y$ just by taking the right linear combinations of $S_+$ and $S_-$:
$S_x = \frac{1}{2}(S_+ + S_-)$
$S_y = \frac{1}{2i}(S_+ - S_-)$
The only final step required is to determine the constant c.  This can be determined by finding the eigenvalues of the $S_x$ and $S_y$ matrices.  You want them to be $-\hbar$, $0$, and $\hbar$.  You can accomplish this by setting $c = \hbar\sqrt{2}$.
As for the commutation relations $[J_i,J_j] = i\hbar\epsilon_{ijk} J_k$, it just means that:
$[S_x,S_y] = i\hbar S_z$
$[S_y,S_z] = i\hbar S_x$
$[S_z,S_x] = i\hbar S_y$
You can verify these directly using matrix multiplication, for example by showing that $S_x S_y - S_y S_x = i\hbar S_z$
