# Finding a matrix $P$ such that $B=P^TAP$ given $A,B$

I have 2 matrices, $$A,B$$ associated with the same bilinear application, where $$A$$ is expressed using the canonical basis $$(1,0,0),(0,1,0),(0,0,1)$$. I need to find the basis $$B$$ is associated with so I can compute $$P$$.

$$B=P^TAP$$

I would love a method that doesn't involve solving a big system of equations.

$$A= \begin{bmatrix} 3 & -2 & 0 \\ 5 & 7 & -8 \\ 0 & -4 & -1 \\ \end{bmatrix}$$

$$B= \begin{bmatrix} 25 & 6 & -8 \\ 17 & 0 & -9 \\ -4 & -5 & -1 \\ \end{bmatrix}$$

• Can you tell about your method and progress for the question? – SNEHIL SANYAL Jan 31 '19 at 17:39
• Making P a matrix with all its integers variables a,b,c,d,e,f,g,h,i and then making matrix multiplication, then solving the system – Marco Villalobos Jan 31 '19 at 18:01
• If $A,B$ were symmetric, then you could orthogonally diagonalize each of them, getting $A=P^TCP$ and $B=Q^TDQ$. Assuming $C=D$ (else there is no solution), then $B=Q^TPAP^TQ=(P^{-1}Q)^TA(P^{-1}Q)$. – vadim123 Jan 31 '19 at 18:08
• Does a method for non-symmetric matrices exist? – Marco Villalobos Jan 31 '19 at 19:05
• How are these matrices “associated with a bilinear application?” If the bilinear form is something like $x^TAx$, then only the symmetric part of $A$ contributes to it, so there’s no a priori reason to believe that there is a solution in the first place. What makes you think that one is possible? – amd Feb 1 '19 at 1:38