I'm having a hard time finding change of basis matrix for bilinear form.

I'm given a matrix $A = \begin{bmatrix} 1 & 1 & 1\\ 1 & 1 &-1\\ 1 & -1 & 1 \\ \end{bmatrix}$ and I need to find matrices $D$ and $C$ such that $D = C^TAC$

I've managed to find $D = \begin{bmatrix} 1 & 0 & 0\\ 0 & -1 & 0\\ 0 & 0 & 1 \\ \end{bmatrix}$ using symmetric Gaussian elimination, but I don't have much clue how to move on from here. Any hint/help would be appreciated!

  • $\begingroup$ I'm guessing $A$ is the metric in some basis and you want to change basis with $C$? Do you have the old and new bases by chance? $\endgroup$ Apr 2 at 17:44
  • $\begingroup$ it is just expressing each symmetric row/column step as an elementary matrix, take the identity and alter just one off-diagonal position. Call it $C_j$ at step $j,$ this being the matrix that goes on the right in $A_{j} = C_j^T A_{j-1} C_j.$ Then $C = C_1 C_2 C_3..$ See my math.stackexchange.com/questions/1388421/… $\endgroup$
    – Will Jagy
    Apr 2 at 17:47
  • $\begingroup$ well, why not. Usually the $C_j$ are upper triangular. However, if an intermediate step creates a zero on the diagonal, the next step is lower triangular; $C_1$ (1,2) set to: $-1$ then $C_2$ (1,3) set to: $-1$ then $C_3$ (3,2) set to: $1$ then $C_4$ (2,3) set to: $-1/2 \; \; \; \; $ so this time $C_3$ is lower triangular Oh... I got to diagonal $(1,-4,1)$ rather than your $(1,-1,1).$ That can be corrected to your target with $C_5$ which is diagonal, middle element $1/2$ $\endgroup$
    – Will Jagy
    Apr 2 at 18:02

1 Answer 1


There is a canonical unitary matrix to diagonalise a bilinear form, which I so called the completing the square tricks. The algorithm is stated below and let $\mathfrak{B}$ be a bilinear form.

  • Step $1$: Separate all monomials from $x_1$. You can write the bilinear form in $f(x_1,\cdots,x_n)^2+f_2(x_2,\cdots,x_n),f,g$ are monomials.
  • Step $2$: Apply step $1$ on $f_2$, but this time, we separate all monomials from $x_2$.
  • Step $3$: We keep applying step $1$ on $f_i$ to separate all monomials from $x_i$ to obtain $f_{i+1}$ until it only contains two variable.

Remark. Sometimes you may not be able to completing the square, like you may get a variable in the form $x_1x_2$ and nothing else. However, we can still write $x_1x_2=\dfrac{1}{4}(x_1+x_2)^2-\dfrac{1}{4}(x_1-x_2)^2.$

Last but not least, you would obtain $\mathfrak{B}$ as a sum of square of monomials. This gives the unitary matrix we want by setting the coefficient of $x_i$ of $f_j$ as the $(i,j)$-th entries, and the whole coefficient of the $f_j$ as the diagonal entries.

Example. We use your example $\mathfrak{B}(x,y,z)=x^2+y^2+z^2+2xy-2yz+2xz$.

Step $1$: We have $\mathfrak{B}=(x+y+z)^2-4yz$. So $f=(x+y+z)$ and $f_2=-4yz$.

Step $2$: $-4yz=(y-z)^2-(y+z)^2$.

So $\mathfrak{B}=(x+y+z)^2+(y-z)^2-(y+z)^2$. This gives

$$\begin{pmatrix}1 & 1 & 1\\1 & 1 &-1\\1&-1&1\end{pmatrix}=\begin{pmatrix}1&0&0\\1&1&1\\ 1&-1&1\end{pmatrix}\begin{pmatrix}1&0&0\\ 0&-1&0\\ 0&0&1\end{pmatrix}\begin{pmatrix}1&0&0\\ 1&1&1\\ 1&-1&1\end{pmatrix}^T$$

  • $\begingroup$ Arh yes, this gives diagonalization of bilinear form, but you should taking back the transpose bc you want a form $D=C^TAC$. $\endgroup$
    – Angae MT
    Apr 2 at 18:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .