construction of matrices verifying an identity

Let $A,B\in\mathbb{R}^{n\times n}$. Suppose that B is nonsingular and $AB\neq BA$. Can we always find real numbers $t_1,⋯,t_p$ such that

$$B\left(\displaystyle\prod_{i=1}^{p}(A+t_{i}B)\right)A=A\left(\displaystyle\prod_{i=1}^{p}(A+t_{i}B)\right)B?$$ N.B : $p$ is not fixed.

-
You should also link your other question mathoverflow.net/questions/98260/… putting in evidence that if both $A$ and $B$ are non-singular, one can easily find counterexamples. – Valerio Capraro Jun 10 '12 at 10:12

No. A counter-example is $$A = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 2 & 0 \\ 0 &0 &0 & 2 \end{pmatrix} \quad B = \begin{pmatrix} 0 & 1 & 1 & 0 \\ -1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 2 \\ 0 & 0 & -2 & 0 \end{pmatrix}.$$
Observe that both matrices live in the image of the embeding $GL_2(\mathbb{C}) \to GL_4(\mathbb{R})$. In these terms, the matrices are $$A = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix} \quad B = \begin{pmatrix} i & 1 \\ 0 & 2i \end{pmatrix}.$$
For any real $t$, the element $A+tB$ is of the form $\left( \begin{smallmatrix} u & v \\ 0 & 2u \end{smallmatrix} \right)$ for $u$ an nonzero complex number. So any product $\prod_{i=1}^p (A+t_i B)$ is of the form $\left( \begin{smallmatrix} u & v \\ 0 & 2^p u \end{smallmatrix} \right)$ for $u$ a nonzero complex number. Now $$A \begin{pmatrix} u & v \\ 0 & 2^p u \end{pmatrix} B = \begin{pmatrix} u & u + 2iv \\ 0 & 2^{p+1} i u \end{pmatrix}$$ $$B \begin{pmatrix} u & v \\ 0 & 2^p u \end{pmatrix} A = \begin{pmatrix} u & 2^{p+1} u + 2iv \\ 0 & 2^{p+1} i u \end{pmatrix}$$ So $2^{p+1} u = u$ and, as $u \neq 0$, we have a contradiction.
A vague attempt to explain how I found this. Let $C$ be the centralizer of $A^{-1}B$. The set of elements $M$ such that $AMB=BMA$ is $C A^{-1}$. The curve $A+tB$ is in $AC$ and it seems hard to find any properties of it which aren't true of all of $AC$. So we basically want to know whether $(AC)^p$ meets $CA^{-1}$ for sufficiently large $p$. I flirt with Hecke operators (because we are basically multiplying double cosets) and ergodic theory (because we want to know if a small subset of a group spreads out under multiplication).
Eventually I decide that the answer is probably "no". If so, then the most likely way to prove it is to find a function $f:GL_n(\mathbb{R}) \to \mathbb{R}$ which is more or less multipliciative, large for positive powers of $A$, small for negative powers of $A$ and bounded on $C$. A character would be great. But the only character of $GL_n$ is determinant and it doesn't work. Eventually, I realize that I can arrange for $A+tB$ to lie in a subgroup $H$ of $GL_n$ which has additional characters; let $T$ be the abelianization of $H$. It also seems like a good idea to make all of the eigenvalues of $A^{-1} B$ complex, as then $A+tB$ is always invertible. In other words, $T$ should have rank at least $2$, and should have lots of $\mathbb{C}^{\ast}$ factors. So I decide to try $H$ $$\begin{pmatrix} a & b & \ast & \ast \\ -b & a & \ast & \ast \\ 0 & 0 & c & -d \\ 0 & 0 & d & c \end{pmatrix}$$ with character $f=\frac{c^2+d^2}{a^2+b^2}$. By taking $f(A) = f(B)>1$, I ensure that $f(C)=1$, so $f$ is bounded on $C$ and large on $A$ as desired. At this point I stop trying to be systematic and just try some examples until one works.