Prove for Sample Mean

Suppose we have variable X following a distribution where E(X)=μ. But we don't know μ, instead we have multiple observations of X, like X1,X2,X3

let

X=(X1X2Xn)

and the mean is

μ^=(μμμ)

Pasted image 20250708182804.png|centre|600

We want to find a value of μ that minimises Xμ^. The residual vector (in red) should thus be minimised. Thus, Xμ^ should be perpendicular to μ^. Using Pythagoras theorem

||μ^||2+||Xμ^||2=||X||2Nμ2+i=1N(Xiμ)2=i=1NXi2i=1Nμ2+Xi22μXi+μ2=i=1NXi22Nμ22μi=1NXi=02Nμ2=2μi=1NXiμ=1Ni=1NXi