Solving a pair of equations across a data set I have the following pair of equations:
$a = x\cos(k) - y\sin(k),\ b = x\sin(k) + y\cos(k)$
I know that all variables but $k$ are in the set $\mathbb{N}^0$.
Given the above, if I know the value of $a$, $b$, and $k$, how do I compute $x$ and $y$?
 A: If we know $a$, $b$, and $k$, we have the matrix equations
$$
\begin{bmatrix}a\\b\end{bmatrix}=\begin{bmatrix}\cos(k)&-\sin(k)\\\sin(k)&\cos(k)\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}\\
\Downarrow\\
\begin{bmatrix}\cos(k)&\sin(k)\\-\sin(k)&\cos(k)\end{bmatrix}\begin{bmatrix}a\\b\end{bmatrix}=\begin{bmatrix}x\\y\end{bmatrix}
$$
which solve for $x$ and $y$.

For Those Who Haven't Seen Matrices Before
The first matrix equation above is a restatement of the question. The second matrix equation is the first multiplied by the inverse of the $2\times2$ matrix, and represents the solution
$$
\begin{align}
x&=\hphantom{-}a\cos(k)+b\sin(k)\\
y&=-a\sin(k)+b\cos(k)
\end{align}
$$
If you plug in the values for $a$ and $b$ from the question, you will see that
$$
\begin{align}
\hphantom{-}a\cos(k)+b\sin(k)&=\hphantom{-}\overbrace{(x\cos(k)-y\sin(k))}^a\cos(k)+\overbrace{(x\sin(k)+y\cos(k))}^b\sin(k)=x\\
-a\sin(k)+b\cos(k)&=-(x\cos(k)-y\sin(k))\sin(k)+(x\sin(k)+y\cos(k))\cos(k)=y
\end{align}
$$
since $\cos^2(k)+\sin^2(k)=1$.
