For example i have this quadratic form $q(x_1,x_2)=8{x_1}^2-4x_1x_2+5{x_2}^2$ , here it's a simple factoring:
$q\begin{bmatrix}x_1 \\x_2 \\x_3\\\end{bmatrix}=\begin{bmatrix}x_1 \\x_2 \\x_3\\\end{bmatrix} \cdot \begin{bmatrix}8x_1 &-2x_2\\-2x_1&5x_2\end{bmatrix}=\vec{x}^{T}A\vec{x} ,A=\begin{bmatrix}8 &-2\\-2&5\end{bmatrix}$.
But this is not always the case where one can simply see how the matrix is going to be ,so is there a certain method of finding this matrix?
The matrix of the quadratic form $q(x_1,x_2)=a{x_1}^2+bx_1x_2+c{x_2}^2$ is always$$\begin{pmatrix}a&\frac b2\\\frac b2&c\end{pmatrix}.$$