<s>[INST] matrix representation of polynomial Here is a polynomial $p(x,y) = (ax + by)^2$, it can be written like this $$p(x,y) = \left(\left[ \begin{array}{cc}
a & b \\
\end{array} \right] \left[ \begin{array}{c}
x\\
y\\
\end{array} \right]\right)^2$$
and I know that it can also be written as something like $v^TMv$, here $v = [x,y]^T$, and $$M = \left[ \begin{array}{cc}
a^2 & ab \\
ab & b^2\\
\end{array} \right]$$. But how could I find out $M$, any technique?
Furthermore, here $p(x,y)$ has degree $2$, and it can be represented with the multiplication of matrix and vector, what if the degree is $3,4...$?
 [/INST] $$\left[ \begin{array}{cc}
a & b \\
\end{array} \right] \left[ \begin{array}{c}
x\\
y
\end{array} \right] = \left[ \begin{array}{cc}
x & y \\
\end{array} \right] \left[ \begin{array}{c}
a\\
b
\end{array} \right]$$
Then $M= \left[ \begin{array}{c}
a & b
\end{array}\right]  \left[ \begin{array}{c}
a\\
b
\end{array}\right]$
Letting $v=\left[ \begin{array}{c}
x\\
y
\end{array} \right]$ and $A=\left[ \begin{array}{cc}
a & b \\
\end{array} \right]$ we use the first line to note that $Av=v^TA^T$., and hence that $$(Av)^2 = (Av)^T(Av) = v^TA^TAv = v^T(A^TA)v$$
So $M=A^TA$.
</s>