Solution (source code)

= Solution

Consider the real <polynomial>
$$
p(t)=\det(A+tB).
$$
The hypothesis says $p(i)\ne0$, so $p$ is not identically zero. A nonzero <polynomial> has only finitely many roots, whereas $\mathbb R$ is infinite. Hence there is a real $\lambda$ with
$$
p(\lambda)=\det(A+\lambda B)\ne0.
$$
\b[Thus $A+\lambda B$ is invertible, as summarized by the <real parameter avoiding a singular matrix pencil>.]