Change angle of a vector to another vector Let $\mathbf{x},\mathbf{y},\mathbf{w}$ be the following 3-vectors:
$$\mathbf{x}=\begin{pmatrix}x_{1}\\ x_{2}\\ x_{3}\end{pmatrix}\qquad\mathbf{y}=\begin{pmatrix}y_{1}\\ y_{2}\\ y_{3}\end{pmatrix}\qquad \mathbf{w}=\begin{pmatrix}0\\0\\1\end{pmatrix}$$
The vector $\mathbf{y}$ has the same magnitude as $\mathbf{x}$ and also lies in the $\mathbf{xw}$ plane, only its angle to $\mathbf{w}$ is a function of angle between $\mathbf{x}$ and $\mathbf{w}$.
Is there an easy way on how to express $\mathbf{y}$ in terms of $\mathbf{x},\mathbf{w}$ and their angle?
I found one way which is very clumsy and complicated:


*

*Find rotation axis (or normal to $\mathbf{xw}$ plane) via cross product: $a=\frac{\mathbf{x}\times\mathbf{w}}{|\mathbf{x}\times\mathbf{w}|}$

*Find angle between $\mathbf{x,w}$ using dot product: $\theta=\cos^{-1}\frac{\mathbf{x}\cdot\mathbf{w}}{|\mathbf{x}|\cdot|\mathbf{w}|}$

*Express rotation as a matrix (using some axis-angle representation): $R(a,\theta)$

*Express $\mathbf{y}$ as $\mathbf{y}=R(a,f(\theta))\mathbf{x}$
These steps lead to a single formula for $\mathbf{y}$, which is quite complicated. I need however such formula to be able to take derivatives of $y$ with respect to $\mathbf{x}_{1,2,3}$ or possible parameter of $f$ (the function may be something like $f(\kappa,\theta)$).
 A: The $xw$ plane can be written as 
$$s\begin{pmatrix}0\\0\\1\end{pmatrix}+t\begin{pmatrix}x_1\\x_2\\x_3\end{pmatrix}$$
So
$$\begin{pmatrix}y_1\\y_2\\y_3\end{pmatrix}=\begin{pmatrix}t x_1\\t x_2\\t x_3+s\end{pmatrix}$$
Angle between $\vec{x}$ and $\vec{w}$ is $\frac{x_3}{||\vec{x}||}$. Angle between $\vec{y}$ and $\vec{w}$ is $\frac{y_3}{||\vec{y}||}$. So $\frac{y_3}{||\vec{y}||}=f(\frac{x_3}{||\vec{x}||})$. If you have a certain function $f$, this should solve $\vec{y}$.
Based on your update, there is another way to think about this problem. Since $x,y$ have same magnitude, let's first assume they are unit vector. Then later you can use the magnitude of $x$ to find the original vector. 
If they are unit, then $x,y,w$ are on the same unit circle that is perpendicular to $xy$ plane. Using spherical coordinate,
$$\begin{pmatrix}\sin{\theta}\cos{\phi}\\
\sin{\theta}\sin{\phi}\\
\cos{\theta}\end{pmatrix}$$ 
$y_3=\cos{((1+\theta^2)\theta)}$. Then you can find the other two components by using the fact that $x,y$ have the same angle $\phi$.
