Let $T: \mathbb{R}^{3} \to \mathbb{R}^{3}$ be the following linear operator, which rotates each vector $v$ about the $z$-axis by an angle $\theta$: $T(x,y,z) = (x\cos\theta-y\sin\theta, x\sin\theta+y\cos\theta, z)$.
Observe that each vector $w = (a,b,0)$ in the $xy$-plane $W$ remains in $W$ under the mapping $T$; hence, $W$ is $T$-invariant. Observe also that the $z$-axis $U$ is invariant under $T$. Furthermore, the restriction of $T$ to $W$ rotates each vector about the origin $0$, and the restriction of $T$ to $U$ is the identity mapping of $U$.
Could someone please help explain this example to me?
First, why is the domain $\mathbb{R}^{3}$? If I had just seen this linear operator, I would have written $T: \mathbb{R}^{4} \to \mathbb{R}^{3}$ with $T(x,y,z,\theta) = (x\cos\theta-y\sin\theta, x\sin\theta+y\cos\theta, z)$... is that incorrect? Would $\theta$ just be given "on the side" somewhere?
Second, where do the formulas $x\cos\theta - y\sin\theta$ and $x\sin\theta+y\cos\theta$ come from? Are they unique? At the moment I am not looking at them thinking "oh right, that's a rotation of angle $\theta$...".
Finally, in general with regard to invariance, is that the same as saying the operator is an endomorphism when it comes to a subspace?
Thank you for any help!