I was learning “change of variable in quadratic form”, which is a way of turning $x^\top A x$ into $y^\top D y$ where $A$ is symmetric and $D$ is diagonal and $x=Py$.
In the explanation i was given this figure:
... and an example where they build $P$ using orthonormal eigen vectors of $A$.
My question is that is $P$ unique? In other words, does $y^\top Dy$ and $x^\top Ax \cdot P$ commute? Or there can be some other $P’$, going from same $y$, built in some other way than using orthonormal eigen vectors of $A$?
—- EDIT: Let me be more specific —-
Is $P$ (or $P^{-1}$) is “universal morphism” that uniquely factorizes $x^\top A x$ (or $y^\top Dy$)?

I figured it by myself.
Let's say there's $K$ that can substitute $P$. It will be $x^\top AKy = y^\top Dy$ but simply, omitting last $y$,
(1) $x^\top AK = y^\top D$.
If we substitute $D$ with it's definition $P^\top AP$, we get
(2) $x^\top AK = y^\top P^\top AP$.
The original change of variable states that $x^\top A P = y^\top P^\top A P$ and if we omit last $AP$ then we get $x^\top = y^\top P^\top$. Use it to omit the prefixs from (1).
(3) $AK = AP$.
$P$ is unique.