I am given a point $ \begin{bmatrix} u & v \end{bmatrix}^T $ which I know is in form $\begin{bmatrix} \frac{x}{f(r)} & \frac{y}{f(r)} \end{bmatrix}^T$ where $f(r)$ is polynomial function, $f(r)=a_nr^n + \cdots + a_1r + a_0$ and $r=\sqrt{x^2+y^2}$.

I want to restore $x$ and $y$ given $u$ and $v$. What I have done so far is below.

$$ u = \frac{x}{f(r)}\\ v = \frac{y}{f(r)}\\ $$

If we square both equations and sum them we get:

$$ \tag{1} f(r) = \frac1{\sqrt{u^2+v^2}}r $$

Which is:

$$ a_nr^n + \cdots + \left(a_1 - \frac1{\sqrt{u^2+v^2}}\right) r + a_0 = 0 $$

I can find the roots of a polynomial using roots() in MATLAB. Then using Equation 1 I can find the value of $f$ and then $u$ and $v$.

When I try this with a numerical example with known polynomial coefficients I cannot restore $x$ and $y$ given $u$ and $v$, the results I am getting do not match. Am I missing something here?

I can provide the coefficients and the numbers I am using if needed.

Update: Here are my values which are not working. First polynomial coefficients $a_0, a_1, a_2$ are $-174.4486, 0, 0.0026$ respectively. Lets start with an original point $p = \begin{bmatrix} \frac{50}{-161.4486} & \frac{50}{-161.4486}\end{bmatrix}^T$. Observe that $p$ is in form described above where $f(r) = -161.4486$, you can calculate if you don't believe me :). Now my given point becomes $\begin{bmatrix}-0.3097 & -0.3097\end{bmatrix}^T$, using only this I want to find $x=50$ and $y=50$. Lets start. We calculate:

$$\frac1{\sqrt{u^2+v^2}} = 2.2832$$

We put it into the polynomial and find the roots which are $r_1= 948.875$ and $r_2=-70.7107$. Since we know $r$ is non negative we choose $r_1$, plug it into the Equation 1 and we get $f(r)=2166.5$ put it into the equations we get $-671$ for $x$ and $y$. Before calculating those values we can understand something is wrong just looking at $r$, it is not the correct value which is $70.7107$.

  • $\begingroup$ As Christian Blatter's answer shows, this procedure ought to work to get you the right solution. I think you should go ahead and provide the numbers you're working with; maybe then we can pinpoint the error. $\endgroup$
    – user856
    Commented Jul 2, 2012 at 21:24
  • $\begingroup$ @RahulNarain I provided the actual values. $\endgroup$
    – nimcap
    Commented Jul 3, 2012 at 15:23
  • $\begingroup$ @nimcap: The mistake is in your equation $(1)$. The correct version is equation $(4)$ in my edited answer. $\endgroup$ Commented Jul 3, 2012 at 18:06

1 Answer 1



The values of $u$ and $v$, and therefore $u^2+v^2$, are given to you, and you want to find $x$, $y$ such that $$(u,v)=\Bigl({x\over f(r)}, {y\over f(r)}\Bigr)\ ,\qquad r:=\sqrt{x^2+y^2}\ .\qquad(2)$$

It follows that we necessarily have $$x=f(r)u\ , \quad y=f(r)v\qquad(3)$$ and therefore $$r^2=(u^2+v^2)f^2(r)\ .\qquad(4)$$

This equation only involves given data and the unknown $r$. Solving it produces a list of values $r_k>0$ (and maybe some other solutions), and to each of these $r_k$ by $(3)$ correspond values $$x_k= u f(r_k)\ ,\quad y_k=v f(r_k)\ .\qquad(5)$$ Now $(5)$ is just a necessary condition that solutions of the original equation $(2)$ would have to fulfill, and we have to prove that such pairs $(x_k,y_k)$ are in fact solutions of $(2)$, i.e., satisfy $$(u,v)=\Bigl({x_k\over f\bigl(\sqrt{x_k^2+y_k^2}\bigr)},{y_k\over f\bigl(\sqrt{x_k^2+y_k^2}\bigr)}\Bigr)\ .$$ To this end we argue as follows: If $x_k$ and $y_k$ are given by $(5)$, where $r_k>0$ is a solution of $(4)$, then $$x_k^2+y_k^2=(u^2+v^2)f^2(r_k)=r_k^2\ .$$ As $r_k>0$ it follows that $\sqrt{x_k^2+y_k^2}=r_k$ and therefore $${x_k\over f\bigl(\sqrt{x_k^2+y_k^2}\bigr)}={x_k\over f(r_k)}=u\ ,$$ and similarly for $y$ resp. $v$.

  • $\begingroup$ I believe that my problem has something to do with squaring and square rooting. I lose or introduce solutions that are not true by doing that, but I can't explain. $\endgroup$
    – nimcap
    Commented Jul 2, 2012 at 19:05
  • $\begingroup$ thank you, it seems I had problem with extraneous solutions, which I forgot about the whole thing by not practicing algebra regularly. $\endgroup$
    – nimcap
    Commented Jul 3, 2012 at 20:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .