# Optimal weighted mean of multidimensional points with covariance estimates

I have multiple measurements of the position of an object in 2D/3D with normally distributed uncertainties. These uncertainties have corresponding covariance matrixes where the off-diagonal terms can be substantial. Let's assume that the object measured is a point. I now want to find the most likely location of the point, and the covariance matrix of our estimate.

My idea is to take the weighted mean of the points $$P^* = w_1 P_1 + w_2 P_2 + \cdots + (1-w_1 - w_2 - \cdots - w_{n-1})P_n$$

find the variance $$var(P^*) = w_1^2 var(P_1) + \cdots + (1-w_1 - \cdots - w_{n-1})^2 var(P_n)$$

and then find the optimal $$\mathbf{w}=\{w_1, w_2, \cdots, w_{n-1} \}$$ that minimizes the variance.

So this is the same as is done in a Kalman filter but with more points than two, and with scalar weights instead of matrix weights.

But I am unable to find the optimal $$var(P^*)$$, when I try to differentiate and set it equal to zero I always end up with things that do not make sense...

Does anyone know if and if so how this can be solved analytically? Or alternatively, some guidance on terms to search for or concepts to read up on? I have found a lot when the points are one dimensional and therefore the covariance is only a variance, but I have not found something when there are off-diagonal elements in the covariance matrix and more than two points...

All help is highly appreciated ^_^