If $2AB = (BA)^2+I_n$ then $1$ is an eigenvalue for $AB$ 
Let $n$ be an odd integer, $A,B$ be $n\times n$ real matrices such that $2AB = (BA)^2+I_n$. Prove that $1$ is an eigenvalue of $AB$.

This was asked at an oral exam. I've been pondering this question for a while without success. 
$1$ is an eigenvalue of $AB$ iff $AB-I_n$ is singular, that is $\det(AB-I_n)=0$ which is equivalent to  $\det ((BA)^2-I_n)=0$. That's all I have noted... I'd appreciate any hint.
I know that $AB$ and $BA$ have the same characteristic polynomials, hence the same eigenvalues. So it may suffice to prove that $1$ is eigenvalue of $BA$, or $\det(BA-I_n)=0$.
 A: The condition implies that $BA$ commutes with $AB$ and hence they are simultaneously triangularisable over $\mathbb C$.
Let $AB$ and $BA$ be simultaneously triangularised. Since $AB$ and $BA$ in general have identical spectra, if $\lambda_1,\ldots,\lambda_n$ are the eigenvalues of $BA$ along its diagonal, then the entries along the diagonal of $AB$ are $\lambda_{\sigma(1)},\ldots,\lambda_{\sigma(n)}$ for some permutation $\sigma$. So, the given condition implies that $f(\lambda_i)=\lambda_{\sigma(i)}$ where $f:z\mapsto (z^2+1)/2$.
In other words, $f$ is a bijection among the eigenvalues of $BA$. As $f$ maps real numbers to real numbers, it must also be a bijection among the real eigenvalues of $BA$.
Since $BA$ is a real matrix of odd dimension, real eigenvalues do exist. Now, as $f(x)\ge x$ on $\mathbb R$, $f$ must map the largest real eigenvalue of $BA$ to itself. Solving $f(x)=x$, we see that this eigenvalue is $1$.

Edit. As the OP points out in his comment, actually we only need to consider the largest real eigenvalue. Let $(\lambda,x)$ be an eigenpair of $BA$, where $\lambda$ is the largest real eigenvalue of $BA$. Then $(\frac{\lambda^2+1}2,x)$ is an eigenpair of $AB$. However, since $AB$ and $BA$ have identical spectra and $\frac{\lambda^2+1}2\ge \lambda$, we must have $\frac{\lambda^2+1}2=\lambda$ and hence $\lambda=1$.
A: There is no need to deal with commuting, etc.
Let $p(x) = {1 \over 2} (x^2 +1)$. Note that $p(x) \ge {1 \over 2}$ for $x $ real.
We have $AB=p(BA)$ and so if
$\mu$ is any eigenvalue of $BA$, then $p(\mu)$ is an eigenvalue of
$AB$.
Note that$AB$ and $BA$ have the same non zero eigenvalues.
If $BA$ has a real
eigenvalue, then $AB$ has a real strictly positive eigenvalue (and
hence so does $BA$). Hence if
$\lambda$ is the $\max$ real eigenvalue of $BA$ we have $\lambda > 0$ (in particular, non zero). We must have that $\lambda$ is also the $\max$ real eigenvalue of $AB$ and hence any real eigenvalue $\mu$ of $AB$ must satisfy
$\mu \le \lambda$.
Since $p(\lambda)$ is
a real eigenvalue of $AB$ and we must have
$p(\lambda) \le \lambda$.
The only real solution to $p(x) \le x$ is $x=1$.
