I want to find the matrix of quadratic form $Q= \sum^p_{i=1} (y_i - \bar y)^2$.
Please help me finding it.
For example I have found the quadratic form matrix for $Q= p\bar y^2$ as follows:
$$Q= p(\frac{y_1+y_2+...+y_p}{p})^2$$
$$\frac{\partial Q}{\partial y_1}=2 (\frac{y_1+y_2+...+y_p}{p})$$
$$....$$
$$\frac{\partial Q}{\partial y_p}=2 (\frac{y_1+y_2+...+y_p}{p})$$
$$\Rightarrow \frac{1}{2}\frac{\partial Q}{\partial y} =\left(\begin{matrix}1/p & 1/p & \cdots & 1/p \\ 1/ p &\cdots & \cdots \cdots & 1/p \\ \vdots & \vdots & \vdots \ddots & \vdots \\ 1/p & \cdots &\cdots&1/p \end{matrix}\right)\left(\begin{matrix} y_1 \\ ... \\ y_p \end{matrix}\right)= A\left(\begin{matrix} y_1 \\ ... \\ y_p \end{matrix}\right)$$ where $A$ is quadratic form matrix.
But I cannot find this matrix A for $Q= \sum^p_{i=1} (y_i - \bar y)^2$.
Thank you for helping.
Note: my trail solution for the question I asked as following ;
Is this true? If not, please show the solution. Thanks.
This is another solution which I believe is simpler than the other one. I suggest this one as it is more compact. Consider the following
$$\begin{array}{l} Q = \sum\limits_{i = 1}^P {{{\left( {{y_i} - \bar y} \right)}^2}} = \sum\limits_{i = 1}^P {\left( {y_i^2 - 2{y_i}\bar y + {{\bar y}^2}} \right)} = \sum\limits_{i = 1}^P {y_i^2} - 2\bar y\sum\limits_{i = 1}^P {{y_i}} + {{\bar y}^2}\sum\limits_{i = 1}^P 1 \\ \,\,\,\,\, = \sum\limits_{i = 1}^P {y_i^2} - 2\bar y\left( {P\bar y} \right) + P{{\bar y}^2} = \sum\limits_{i = 1}^P {y_i^2} - 2P{{\bar y}^2} + P{{\bar y}^2}\\ \,\,\,\,\, = \sum\limits_{i = 1}^P {y_i^2} - P{{\bar y}^2} \end{array}\tag{1}$$
and hence
$$\eqalign{ & {{\partial Q} \over {\partial {y_k}}} = {\partial \over {\partial {y_k}}}\left( {\sum\limits_{i = 1}^P {y_i^2} - P{{\bar y}^2}} \right) = \sum\limits_{i = 1}^P {2{y_i}{{\partial {y_i}} \over {\partial {y_k}}}} - 2P\bar y{{\partial \bar y} \over {\partial {y_k}}} \cr & \,\,\,\,\,\,\,\,\,\,\, = 2\sum\limits_{i = 1}^P {{\delta _{ik}}{y_i}} - 2P\bar y{1 \over P} = 2\left( {\sum\limits_{i = 1}^P {{\delta _{ik}}{y_i}} - \bar y} \right) \cr & \,\,\,\,\,\,\,\,\,\,\, = 2\left( {\sum\limits_{i = 1}^P {{\delta _{ik}}{y_i}} - {1 \over P}\sum\limits_{i = 1}^P {{y_i}} } \right) \cr & \,\,\,\,\,\,\,\,\,\, = 2\sum\limits_{i = 1}^P {\left( {{\delta _{ik}} - {1 \over P}} \right){y_i}} = 2\sum\limits_{i = 1}^P {{A_{ik}}{y_i}} \cr}\tag{2} $$
and finally we can conclude that
$${A_{ik}} = {\delta _{ik}} - {1 \over P}\tag{3}$$
or equivalently
$${A_{ik}} = \left\{ \matrix{ 1 - {1 \over P}\,\,\,\,\,\,\,\,\,\,\,\,i = k\, \hfill \cr - {1 \over P}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,i \ne k\, \hfill \cr} \right.\tag{4}$$