I have spent hours on this and cant see where Im going wrong. First before I explain my problem here is the formula that I am working with...

$\displaystyle \tau^2=\frac{Q-n+1}{C}$

where

$\displaystyle Q=\sum^{n}_{i=1}(w_{i}\theta_{i}^2)-\frac{(\sum^{n}_{i=1}(w_{i}\theta_{i}))^2}{\sum^{n }_{i=1}(w_{i})}$

$\displaystyle C=\sum^{n}_{i=1}(w_{i})-\frac{\sum^{n}_{i=1}(w_{i}^2)}{\sum^{n}_{i=1}(w_{i })}$

$\displaystyle w_{i}$ and $\displaystyle \theta_{i}$ are known values

$\displaystyle w_{i}=w_{1}, w_{2}, ... , w_{n}$

$\displaystyle \theta_{i}=\theta_{1}, \theta_{2}, ... , \theta_{n}$

I want to know how to change $\displaystyle \tau^2$ to a set value by adding another $\displaystyle \theta$ and w, which I will denote $\displaystyle \theta_0$ and $\displaystyle w_0$. I appreciate this is a 2-dimensional problem so I would like to know the value of $\displaystyle \theta_0$ which would make $\displaystyle \tau^2$= a given value if I also set $\displaystyle w_0$ to be a given value. To do this I have tried to derive an equation in the form $\displaystyle \theta_0=f(\tau^2,w_0)$ where f is some function.

Given the 'extra values' $\displaystyle \theta_0$ and $\displaystyle w_0$, the formula for $\displaystyle \tau^2$ now becomes...

$\displaystyle \tau^2=\frac{Q-n}{C}$

where

$\displaystyle Q=\sum^{n}_{i=1}(w_{i}\theta_{i}^2)+w_0\theta_0^2-\frac{(\sum^{n}_{i=1}(w_{i}\theta_{i})+w_0\theta_0 )^2}{\sum^{n}_{i=1}(w_{i})+w_0}$

$\displaystyle C=\sum^{n}_{i=1}(w_{i})+w_0-\frac{\sum^{n}_{i=1}(w_{i}^2)+w_0^2}{\sum^{n}_{i=1 }(w_{i})+w_0}$

$\displaystyle w_{i}$ and $\displaystyle \theta_{i}$ are known values

$\displaystyle w_{i}=w_{1}, w_{2}, ... , w_{n}$

$\displaystyle \theta_{i}=\theta_{1}, \theta_{2}, ... , \theta_{n}$

To simplify things, let

$\displaystyle v=\sum^{n}_{i=1}(w_{i}^2)$

$\displaystyle x=\sum^{n}_{i=1}(w_{i}\theta_{i})$

$\displaystyle y=\sum^{n}_{i=1}(w_{i})$

$\displaystyle z=\sum^{n}_{i=1}(w_{i}\theta_{i}^2)$

which can all be evaluated given we have values for $\displaystyle w_{i}$ and $\displaystyle \theta_{i}$. So, now for the derivation...

$\displaystyle \tau^2= \frac{z+w_0\theta_0^2-\frac{(x+w_0\theta_0)^2}{y+w_0}-n}{y+w_0-\frac{v + w_0^2}{y+w_0}} $

$\displaystyle \tau^2(y+w_0-\frac{v + w_0^2}{y+w_0}) = z+w_0\theta_0^2-\frac{(x+w_0\theta_0)^2}{y+w_0}-n$

$\displaystyle \tau^2(y+w_0-\frac{v + w_0^2}{y+w_0}) = \theta_0^2(\frac{yw_0}{y+w_0})-\theta_0(\frac{2xw_0}{y+w_0}) +z - n - \frac{x^2}{y+w_0}$

$\displaystyle \tau^2(y+w_0-\frac{v + w_0^2}{y+w_0})(\frac{y+w_0}{yw_0}) = (\theta_0-\frac{x}{y})^2 + (\frac{y+w_0}{yw_0}) (z - n - \frac{x^2}{y+w_0})-0.25(\frac{2x}{y})^2$

$\displaystyle \tau^2(y+w_0-\frac{v + w_0^2}{y+w_0})(\frac{y+w_0}{yw_0}) -(\frac{y+w_0}{yw_0}) (z - n - \frac{x^2}{y+w_0})+0.25(\frac{2x}{y})^2= (\theta_0-\frac{x}{y})^2$

$\displaystyle \theta_0=\frac{x}{y} \pm \sqrt(\tau^2(y+w_0-\frac{v + w_0^2}{y+w_0})(\frac{y+w_0}{yw_0}) -(\frac{y+w_0}{yw_0}) (z - n - \frac{x^2}{y+w_0})+(\frac{x}{y})^2)$

Everything seems right but when I test it by finding $\displaystyle \theta_0$ and substituting back into the $\displaystyle \tau^2$ formula I am not getting the right result for $\displaystyle \tau^2$. Where am I going wrong???

Any help much appreciated.