So two independent analyses of a content in a water sample have been made using two different methods, both without systematical errors but with different standard deviations. Method $B$ is assumed to have twice the standard deviation as method $A$. $x_A$ and $x_B$ are the measured contents and $\mu$ is the real content.
By minimizing
$Q(\mu) = \lambda \left( \left( \frac{x_A - \mu}{\sigma_A} \right)^2 + \left( \frac{x_B-\mu}{\sigma_B} \right)^2 \right)$ and putting $\lambda = \sigma_A^2,$ I get $\hat{\mu} = \frac{4}{5}x_A + \frac{1}{5}x_B$.
The estimation is unbiased (I have been able to show that $E(\hat{\mu}) = \mu)$
Now I want to show that $\hat{\mu}$ has minimal variance compared to all other unbiased estimates that can be written on the form $a x_A + b x_B$, by minimizing $\mathrm{Var}(ax_A + bx_B)$ as $a+b=1$.
So I have
$\mathrm{Var}(ax_A + bx_B) = a^2 \mathrm{Var}(x_A) + b^2 \mathrm{Var}(x_B) = a^2 \sigma^2 + 4b^2 \sigma^2 + 2ab\mathrm{Cov}(x_A,x_B),$ which is minimized by differentiating and putting the derivative equal to zero.
Since the analyses are independent, I'm assuming the covariance is equal to zero. So to minimize I solve
$2a^2 \sigma + 8b^2 \sigma = 0$ and $a+b=1$ which gives me the solution $b = \frac{1}{5} \pm \frac{2}{5}i,$ and $ a = 1-b$.
So if I understand the problem correctly, I have almost reached the correct result, except there shouldn't be an imaginary part. Have I done something wrong (since my result is a complex number and I'm thinking it probably shouldn't be)?
You differentiated with respect to $\sigma$, but $\sigma$ is fixed; your variables are $a$ and $b$, subject to $a+b=1$.
So you need to differentiate $a^2\sigma^2+4b^2\sigma^2=a^2\sigma^2+4(1-a)^2\sigma^2=(5a^2-8a+4)\sigma^2$ with respect to $a$, yielding $10a-8=0$ and thus $a=\frac45$ as expected.