Find a linear transformation such that $S^2 = T$ (general case) Suppose a linear transformation $T:\mathbb{R}^3\rightarrow \mathbb{R}^3$, $T\begin{pmatrix}
x\\ 
y\\ 
z
\end{pmatrix} = \begin{pmatrix}
x+y\\ 
y+z\\ 
z+x
\end{pmatrix}$ (just an example).
How do i find a linear transformation S such that $S^2=S\circ S=T$ ?
it's part of a basic linear algebra course. Would appreciate a general answer (not specific to the example above). Iv'e already tried several ways, didn't manage to get somewhere.. 
Thanks.
EDIT: The answer is supposed to be based only on basic matrices and linear transformations material, no Diagonalization and eigenvalues 
 A: First of all let's form a basis space for your linear transformation. In order to do so, form its values via the normal vectors $e_1,e_2,e_3$ since your linear transformation $T$ "lives" in $\mathbb R^3$ (basis vector may be subject to change depending on the definition of the transformation) : 
$$T(e_1) = (1,0,1)$$
$$T(e_2) = (1,1,0)$$
$$T(e_3) = (0,1,1)$$
This means that a basis space matrix for your linear transformation $T$ is the matrix : 
$$\mathbb{T} = \begin{bmatrix} 1 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1\end{bmatrix}$$
In the case of a linear transformation $S : \mathbb R^3 \to \mathbb R^3$ such that $S \circ S = S^2 = T$, this means that the basis matrix of $S^2$ should be the same as the one of $T$.
Let $S$ be the linear transformation :
$$S(x,y,z) = (a_1x +b_1y+c_1z, a_2x+b_2y+c_2z,a_3x+b_3y+c_3y)$$
By substituting "in" the RHS and finding the expression for $S\circ S= S^2$, you then demand that : 
$$(S\circ S)(e_1) = (1,0,1)$$
$$(S\circ S)(e_2) = (1,1,0)$$
$$(S\circ S)(e_3) = (0,1,1)$$
$$\mathbb S^2 = \mathbb T$$
This is a brute force method and definitely requires a lot of work.
The standard and straight way approach to this, is by eigenvalue approximation of the linear transformation matrix $\mathbb T$. Then, simply find the eigenvalues (if $T$ is diagonalizable) by : 
$$\det(\mathbb T-\lambda I)=0 \Rightarrow \dots$$
and the eigenvectors by : 
$$\det(\mathbb T-\lambda_iI)v_i =0, \space \space \text{for} \space \space i=1,2,3$$
since your matrix is a $3$-dimensional one. Then, it shall be diagonalized as : 
$$\mathbb T = JVJ^{-1}$$
and it is elementary proven that : 
$$\mathbb T^{1/2} = JV^{1/2}J^{-1}=\mathbb S^2$$
Note : In this particular case the eigenvalues are complex numbers, which means there's trouble.
A: S is linear from $R^{3}$ to $R^{3}$. so $S(x)= AX+B$, $A $ is 3 by 3 matrix and B is a constant vector in $R^{3}$. the same for T, then we have:
$$S(x)=Ax+B$$
$$T(x)=Cx+D$$
$$SoS=T$$
$$A(Ax+B)+B=Cx+D$$
$$A^{2}x+AB+B=Cx+D$$
$$A^{2}=C$$
$$AB+B=D$$
$$(A+I)B=D$$
Now you have to have T, i.e C and D to solve the equations
A: In general, there is no such matrix (or transformation). By that I mean that if you give me a transformation $T$, there's no guarantee that there's a transformation $S$ with $S^2 = T$. It's possible that you might give me a $T$ for which there is such an $S$, but even then, finding $S$ may involve challenges. For instance, if the matrix for $T$ is 
$$
\pmatrix{1 & 0 \\ 0 & 1},
$$
then $S$ could be any of
$$
\pmatrix{1 & 0 \\ 0 & 1},
\pmatrix{-1 & 0 \\ 0 & 1},
\pmatrix{1 & 0 \\ 0 & -1},
\pmatrix{-1 & 0 \\ 0 & -1},
$$
so a simple algorithm that gives you just one of these will have to make choices along the way, which is generally risky: for nearby inputs, those choices may lead to non-solutions. 
Anyhow, as I said, in general, given a transformation $T$, you cannot hope to find such a transformation $S$. 
Why? 


*

*Because every linear transformation on 3-space has a representation as a matrix transformation with respect to the standard basis, and

*Because there's a function called "det" (for "determinant") with the property that for any two square matrices of the same size, 
$$
\det(AB) = \det(A) \det(B)
$$
In your case, that means that 
$$
\det(T) = (\det S)^2.
$$
But if the determinant of (the matrix for) $T$ is negative (as it is for the transformation $(x, y, z) \mapsto (-x, -y, -z)$), then it has no "square root".
Now all this requires believing that such a function, det, actually exists, and you'll learn that later in your course, I expect. But for now, my main point was to let you know that you're on a wild goose chase, and you can stop. 
A: Here is an explicit counterexample:
Consider the linear transformation $T:\mathbb{R} \to \mathbb{R}$, $x \mapsto -x$. If $S:\mathbb{R} \to \mathbb{R}$, $x \mapsto ax$ (for some $a \in \mathbb{R}$) is a linear transformation satisfying $S \circ S = T$, then $-1 = T(1) = (S \circ S)(1) = a^2 \cdot 1$. But since we are working over the reals, we cannot have $a^2 = -1$. So in general, we cannot find the transformation you are looking for.
A: If your $T$ is just an example, if you are wondering whether there are linear transformations/matrices such that $T^2=T$, the answer is: yes, they are called projection matrices (well, they are idempotent matrices, but let's keep it simple.) See Wikipedia: For example, the function which maps the point $(x, y, z)$ in three-dimensional space $\mathbb{R}^3$ to the point $(x,y,0)$ is an orthogonal projection onto the $x–y$ plane. This function, $T(x,y,z)=(x,y,0)$, is represented by the matrix:
$$P=\begin{bmatrix}1&0&0\\0&1&0\\0&0&0\end{bmatrix}$$ 
and you can easily verify that $PP=P$ (if you project a vector and then project its projection, you get the same projection.)
Let me say that the eigenvalues of a projection matrix must be $0$ or $1$. As you'll see later, this is why $\det(P)=\det(PP)=0$ or $1$.
More examples:
$$T(x,y,z)=(x+z,y+z,0), P=\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{bmatrix}$$
$$T(x,y,z)=(-z,-z,z), P=\begin{bmatrix} 0 & 0 & -1 \\ 0 & 0 & -1 \\ 0 & 0 & 1 \end{bmatrix}$$
In general, if $X$ is a full rank matrix then $P=X(X^TA)^{-1}X^T$ is a projection matrix, e.g.
$$X=\begin{bmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 3 \end{bmatrix},\;P=X(X^TA)^{-1}X^T=\begin{bmatrix} 5/6 & 1/3 & -1/6 \\ 1/3 & 1/3 & 1/3 \\ -1/6 & 1/3 & 5/6\end{bmatrix},\;PP=P$$
