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=(X1X2⋮Xn)

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||2∑Nμ2+∑i=1N(Xi−μ)2=∑i=1NXi2∑i=1Nμ2+Xi2−2μXi+μ2=∑i=1NXi22Nμ2−2μ∑i=1NXi=02Nμ2=2μ∑i=1NXiμ=1N∑i=1NXi