How to express the sample variance as a homogeneous quadratic form when the population variance is known? Given $\widetilde{S}^{2}=\frac{\sum_{i=1}^{n}{(X_{i}-\mu)^2}}{n}$ where $X=(X_{1},X_{2},...,X_{n})^T$.
I was trying to find the $n\times n$ matrix $A$ for this quadratic form; that is,
$$\widetilde{S}^{2}=\frac{\sum_{i=1}^{n}{(X_{i}-\mu)^2}}{n}=X^{T}AX.$$
I am facing a problem with $\mu,$ as it is known it is not a random variable.
In the case of sample variance when ${S}^{2}=\frac{\sum_{i=1}^{n}{(X_{i}-\bar{X})^2}}{n-1}$ then $A$ is $I-\frac{1}{n}11^{T},$ which gives us $\bar{X}$. But how can we make this thing for a population mean $\mu$?
I was trying to write $$\widetilde{S}^{2}=\frac{\sum_{i=1}^{n}{(X_{i}-\mu)^2}}{n}=\frac{1}{n}(\sum_{i=1}^{n} X_{i}^2-\frac{2}{n} \sum_{i=1}^{n} X_{i}\mu+n\mu^{2})=X^{T}AX$$
(like $X_{1}^{2}+6X_{1}X_{2}+X_{2}^2=X^{T}AX$ Where $A$ is a $(1,3,3,1)$ $2\times2$ symmetric matrix.
So it would be helpful if someone could explain how to find $A$ for $$\widetilde{S}^{2}=\frac{\sum_{i=1}^{n}{(X_{i}-\mu)^2}}{n}=X^{T}AX.$$
 A: Notice that your form $\widetilde{S}^{2}$ contains the additive constant term $\mu^2.$ Unless $\mu=0,$ this will never appear in $\mathbf X^\prime \mathbb A \mathbf X$ because all of those terms are quadratic in $\mathbf X.$  Thus, you cannot succeed exactly as planned.
What you can hope to do is to write your form as $\mathbf X^\prime \mathbb A \mathbf X + \mathbf 2\mathbf b^\prime \mathbf X + c$ for a suitable vector $\mathbf b$ and constant $c.$ This can be done using the definition of matrix multiplication and comparing both sides:
$$\begin{aligned}
\widetilde{S}^{2} &=  \sum_{i=1}^n \frac{1}{n}\left(X_i-\mu\right)^2 = \sum_{i=1}^n \frac{1}{n}X_i^2 - \sum_{i=1}^n \frac{2\mu}{n} X_i + \sum_{i=1}^n \frac{\mu^2}{n} \\
&= \mathbf X^\prime \mathbb A \mathbf X+ 2\mathbf{b} \mathbf X + c \\
&= \sum_{i=1,j=1}^n X_i a_{ij} X_j + \sum_{i=1}^n 2b_iX_i + c,
\end{aligned}$$
whence you can set
$$\mathbb{A}=(a_{ij}); \quad a_{ij} = \left\{\begin{aligned} \frac{1}{n}, & \quad i=j \\ 0, & \quad i\ne j\end{aligned}\right.$$
and, more evidently, $\mathbf b = (b_i);\ b_i = -\mu/n$ and $c = \mu^2.$
There's a useful technique, widely employed in mathematics, to express this as a homogeneous quadratic form (that is, using a matrix alone with nothing else added to it): introduce a constant component.  More formally, we are embedding the vector space $\mathbb R^n$ into $\mathbb R^{n+1}$ via the linear affine map
$$\mathbf X = \pmatrix{X_1 \\ X_2 \\ \vdots \\ X_n} \to  \pmatrix{1 & 0 & \cdots & 0  \\ 0 & 1 & \cdots & 0  \\ \vdots & \vdots & \ddots  & 0\\ 0 & \cdots & 0 & 1  \\ 0 & \cdots & 0 & 0 }\mathbf{X} + \pmatrix{0\\0\\\vdots\\0\\1} = \pmatrix{X_1 \\ X_2 \\ \vdots \\ X_n \\ 1} = \mathbf Y.$$
(This is rigorous: because affine maps are Lebesgue measurable and measurable functions of random variables are themselves random variables, $\mathbf Y$ is a random variable.)
Thus, if we set $\mathbf Y = (X_1, X_2, \ldots, X_n, 1)^\prime = (\mathbf X;1)^\prime$ then, in block matrix form, we have
$$\widetilde S^2 = \mathbf Y^\prime \pmatrix{\mathbb A & \mathbf b \\  \mathbf b^\prime & c} \mathbf Y = \mathbf X^\prime \mathbb A \mathbf X + \mathbf b^\prime \mathbf X + \mathbf X^\prime \mathbf b + (1)(c)(1) = \mathbf X^\prime \mathbb A \mathbf X + 2\mathbf b^\prime \mathbf X + c.$$
In the application in question this block matrix is
$$\pmatrix{\mathbb A & \mathbf b \\  \mathbf b^\prime & c} =\pmatrix{\frac{1}{n} & 0 & \cdots & 0 & -\frac{\mu}{n} \\ 0 & \frac{1}{n} & \cdots & 0  & -\frac{\mu}{n}\\ \vdots & \vdots & \ddots & \vdots  & -\frac{\mu}{n}\\ 0 & \cdots & 0 & \frac{1}{n} & -\frac{\mu}{n} \\ -\frac{\mu}{n} & \cdots & -\frac{\mu}{n} & -\frac{\mu}{n} & \mu^2}.$$
