$\newcommand{\ab}[1]{\langle #1\rangle}\DeclareMathOperator{\tr}{trace}\newcommand{\mc}{\mathcal}$
I have a "proof" of the following wrong fact:
Let $T$ be a linear operator on a finite dimensional complex inner product space. Let $U$ be a $T$-invariant subspace of $V$. Then $U^\perp$ is also $T$-invariant.
(The proof is motivated from this page.)
We use the fact that writing $\ab{T, S}=\tr(TS^*)$ defines an inner product on the linear space $\mc L(V)$. Let $p:V\to V$ denote the projection on $U$ with respect to $U^\perp$ and note that saying $U$ is invariant under $T$ is same as writing $(I-p)Tp=0$. So to show that $U^\perp$ is invariant under $T$, we need to show that $S:=pT(I-p)=0$. To do this, it suffices to show that $\tr(S S^*)=0$. Since $p$ is is an orthogonal projection map, we have $p^*=p$.
Using $\tr(AB)=\tr(BA)$ for $A, B\in \mc L(V)$, we have
$$ \begin{array}{rcl} \tr(SS^*) &=& \tr(pT(I-p)(I-p)T^*p)\\ &=& \tr(pT(I-p)^2T^*p)\\ &=& \tr(pT(I-p)T^*p)\\ &=& \tr((pT-pTp)T^*p)\\ &=& \tr(pTT^*p)-\tr(pTpT^*p)\\ &=& \tr(p^2TT^*)-\tr(p^3TT^*)\\ &=& \tr(pTT^*)-\tr(pTT^*) = 0 \end{array} $$ And therefore we have our result.
Where am I making a mistake?
The problem is that $pT\neq Tp$ in general, so the traces of $pTpT^*p$ and $p^2TT^*p$ need not be equal.
Consider the linear operator $$ T = \begin{pmatrix} 2&1\\ 0&2 \end{pmatrix} $$ on $\mathbb C^2$. Now $U=\{(x,0);x\in\mathbb C\}$ is $T$-invariant ($TU\subset U$) but its orthogonal complement $U^\perp=\{(0,y);y\in\mathbb C\}$ is not.
Simple calculations give $$ p = \begin{pmatrix} 1&0\\ 0&0 \end{pmatrix}, \quad (I-p)Tp=0, \quad pT(1-p) = \begin{pmatrix} 0&1\\ 0&0 \end{pmatrix}. $$ Now the two traces are indeed different, as a calculation shows you. In fact, the traces of $pTpT^*p$ and $p^2TT^*p$ are the square norms of $pTp$ and $pT$, respectively, and $$ pTp = \begin{pmatrix} 2&0\\ 0&0 \end{pmatrix}, \quad pT = \begin{pmatrix} 2&1\\ 0&0 \end{pmatrix}. $$