I have the following problem:
In order to extract features from human joint based 3D data I only consider the angles of the resulting bones (e.g., vector given by shoulder left joint to elbow left joint) with respect to the $y$- and $z$-axes. Consequently $\angle Y$ is the angle that the vector $v$ makes with the $y$-axis and $\angle Z$ the analogous angle between $v$ and the z$-axis.
Computing the angles is trivial because we have the formula $$ \cos A = \frac{v_1 \cdot v_2}{|v_1||v_2|} . $$
My problem arises when I want to do the computation backwards, which means that the angles are given. Since I also know the respected axes, I have to find out what my original vector $v$ was.
Up to now I have tried to do it with rotation matrices which failed since I was not able to determine the correct vector.
Do you have any idea which steps are required to compute the vector $v$?
You need more data, namely its magnitude, to determine the vector. The angles are enough to determine the direction of the vector, so henceforth let's assume we're looking for a unit vector $\mathbf{v}$ that makes the indicated angles.
Let $\mathbf{i}$ be the unit vector in the $x$-direction. Then, using your formula, the angle $\angle X$ the vector $\mathbf{v}$ makes with the $x$-axis satisfies $$\cos \angle X = \frac{\mathbf{v} \cdot \mathbf{i}}{|\mathbf{v}||\mathbf{i}|} = \mathbf{v} \cdot \mathbf{i}.$$ Now, $\mathbf{v} \cdot \mathbf{i}$ is just the projection of $\mathbf{v}$ onto the $x$-axis, that is, the $x$-coordinate of $\mathbf{x}$. By symmetry, the $y$- and $z$-components are analogous, so the vector is $$\mathbf{v} = (\cos \angle X, \cos \angle Y, \cos \angle Z).$$
If we know that $\mathbf{v}$ has magnitude $\lambda$ rather than $1$, the vector is $$\mathbf{v} = (\lambda \cos \angle X, \lambda \cos \angle Y, \lambda \cos \angle Z).$$