I'll put the question first, and then the background, because I'm not sure that the background is necessary to answer the question:
I have a geometric proof, but is there an elegant algebraic proof that $ \left[ \begin{matrix}-1 & 1 + \cos\frac{\pi}{2n} \\ -2 & 1 + 2\cos\frac{\pi}{2n}\end{matrix} \right] ^n \left[ \begin{matrix}0 \\ 1\end{matrix} \right] = \left[ \begin{matrix}\cot \frac{\pi}{4n} \\ \cot \frac{\pi}{4n}\end{matrix} \right]$
Background:
This is motivated by the latest maths puzzle from Spanish newspaper El País (problem statement there in Spanish, obviously). NB the deadline for submitting solutions to win the prize has passed, so don't worry about cheating. The relevant part of the problem is this:
We have two straight lines (in Euclidean geometry) and we wish to draw a zigzag between them. We start at the intersection point and draw a straight line segment of length $r$ along one of the lines (which we shall call the "horizontal line"). We then draw a straight line segment of length $r$ from the end-point to the other ("non-horizontal") line. We alternate between the two with straight line segments of the same length, without overlapping or doubling back. The 20th such line segment is perpendicular to the horizontal line. What is the angle between the lines?
There's a simple geometric solution (which I shan't state here, in case anyone wants to solve it himself - although I expect that an answer may include spoilers, so if you do want to solve it yourself, look away now), but before finding it I went down an algebraic approach which led me to an equation involving a matrix similar to the one above raised to the 10th power. Basically the equation above is the generalisation to the case with $2n$ line segments and the answer (derived from the geometric proof) substituted for the unknown angle.
The question is motivated by little more than curiosity, because I already have a proof. I've tried to prove it myself, but the best I've got so far is a messy expression in terms of some matrices whose powers do have a relatively nice closed form.
Filling in some gaps: if the lines intersect at the origin, the horizontal line is along the x-axis, the non-horizontal line is in the first quadrant, and the angle between the lines is $\alpha$, then the points are $P_{2n} = (x_{2n}, x_{2n} \tan \alpha)$ and $P_{2n+1} = (x_{2n+1}, 0)$. Given that the distance between each pair of consecutive points is $r$ we find that $x_{2n}$ and $x_{2n+2}$ are the two roots of $(z - x_{2n+1})^2 + z^2 \tan^2 \alpha = r^2$, and we can use the properties of the quadratic equation to get $x_{2n+2} = \frac{2}{1 + \tan^2 \alpha}x_{2n+1} - x_{2n}$ By using the symmetry of the triangle formed by $P_{2n+1}$, $P_{2n+2}$, $P_{2n+3}$, we get $x_{2n+3} = 2x_{2n+2} - x_{2n+1}$ Putting this all together we can get a recurrence which leads to an expression for $(x_{2n}, x_{2n+1})$ in terms of the nth power of a matrix applied to $(x_{0} = 0, x_{1} = 1)$. Putting any more details risks spoiling the value of $\alpha$. The RHS of the original equation comes from observing that if the $(2n)^{th}$ line segment is perpendicular to the horizontal line, $x_{2n-1} = x_{2n} = x_{2n+1}$ and $\tan \alpha = r / x_{2n}$.
The furthest I've got so far with the matrix is to split it out as $\left( \cos\frac{\pi}{2n} \left[ \begin{matrix}0 & 1 \\ 0 & 2\end{matrix} \right] + \left[ \begin{matrix}-1 & 1 \\ -2 & 1\end{matrix} \right] \right)^n = \sum_{k=0}^{n} \left( \begin{matrix}n \\ k\end{matrix} \right) \cos^k\frac{\pi}{2n} \left[ \begin{matrix}0 & 1 \\ 0 & 2\end{matrix} \right]^k \left[ \begin{matrix}-1 & 1 \\ -2 & 1\end{matrix} \right]^{n-k} $
where both of the matrix powers on the RHS have closed forms - the markup here doesn't seem to like the URLs and I've taken too long to write this up and need to run, but http://www.wolframalpha.com/input/?i=[[0,1],[0,2]]^k and http://www.wolframalpha.com/input/?i=[[-1,1],[-2,1]]^(r-k)