# Inverse of function with 3 variables

#### theHeavyLobster

So, I do have a formula that generates a point, to do so, it will compute with 3 variables (u, v, a) and I want to find out what the variables are for a given point. Here's the function:

$$\displaystyle \binom{u}{v}+\frac{u*\sin(e)-v*\cos(e)}{sin(a)}*\binom{\cos(a+e)}{\sin(a+e)} + \frac{u*\cos(e+d+0.5a)+v*\sin(e+d+0.5a)}{-\sin(a)}*\binom{\sin(e+0.5a)}{-\cos(e+0.5a)}$$

UV is a vector and a,d and e are angles, although e & d are set parameters. The formula works, but I don't know how I inverse it. Do I write the formula down like:

f(u,v,a)=[...]

or can I split it up

f(u)*f(v)*f(a) or is it a chain,

I'm completely lost here, so any insight or link would help me.

#### romsek

Math Team
you've got

$\begin{pmatrix}x \\y\end{pmatrix} = f(u,v,a)$

do you want

$\begin{pmatrix}u\\v\\a\end{pmatrix} = f^{-1}(x,y) ?$

I suspect there are infinite combinations of $(u,v,a)$ that produce a given $(x,y)$ and thus no inverse exists.

Where does $f$ arise from?

2 people

#### theHeavyLobster

do you want

$\begin{pmatrix}u\\v\\a\end{pmatrix} = f^{-1}(x,y) ?$
Yes, that's what I need.

I suspect there are infinite combinations of $(u,v,a)$ that produce a given $(x,y)$ and thus no inverse exists.
Now that I think of it, you are right, there are infinite combinations, but there is a way to narrow the solutions for any given point to 1. That's if I add in another output:

$\begin{pmatrix}u\\v\\a\end{pmatrix} = f^{-1}(x,y,r)$

Where does $f$ arise from?
Now I explain why r is important. The formula is describing a centerpoint of a circle. that circle has a radius:

$r = \frac{b*\cos(a/2)}{\sin(a)}$

There there is only one combination of u,v,a for x,y,r.

#### SDK

Yes, that's what I need.

Now that I think of it, you are right, there are infinite combinations, but there is a way to narrow the solutions for any given point to 1. That's if I add in another output:

$\begin{pmatrix}u\\v\\a\end{pmatrix} = f^{-1}(x,y,r)$

Now I explain why r is important. The formula is describing a centerpoint of a circle. that circle has a radius:

$r = \frac{b*\cos(a/2)}{\sin(a)}$

There there is only one combination of u,v,a for x,y,r.
This situation is covered by the inverse function theorem. Namely, your function has the form $f: \mathbb{R}^3 \to \mathbb{R}^2$. So any regular point of $f$ will have a local inverse. This means you can parameterize level sets of $f$ by defining one of the variables as a function of the other 2 in the form
$f(u,v,a) = f(u,v,g(u,v))$
and locally the level set will be the graph of $g$. This means level sets are 1-dimensional differentiable manifolds near any regular point.

As you have noticed, if you fix a value of $r = r_0$, then level sets for this in the domain of $f$ are also 1-dimensional differentiable manifolds. Generically, two 1-dimensional manifolds will intersect in $\mathbb{R}^2$ at a single point (locally) which is the unique value you are describing.

See the following link for a more thorough introduction.
https://en.wikipedia.org/wiki/Inverse_function_theorem

Last edited:
2 people

#### theHeavyLobster

This situation is covered by the inverse function theorem. [...]
See the following link for a more thorough introduction.
https://en.wikipedia.org/wiki/Inverse_function_theorem
Thanks,

as someone who is not studying in a math-related field, missing knowledge of calculus 1 or 2, I see lot's of things I haven't heard or used before, so going from trigonometry to Inverse function theorem seems ambitious.

Here is, how I would approach it though:

$$\displaystyle \begin{pmatrix}u\\v\\a\end{pmatrix}=f^{-1}(x,y,r) \\ f(u,v,a) = \begin{pmatrix}x\\y\\r\end{pmatrix}$$

$$\displaystyle x = u+\frac{u*\sin(e)-v*\cos(e)}{\sin(a)}*\cos(a+e)+\frac{u*\cos(e+d+a/2)-v*\sin(e+d+a/2)}{-\sin(a)}*\sin(e+a/2)$$

$$\displaystyle y = v+\frac{u*\sin(e)-v*\cos(e)}{\sin(a)}*\sin(a+e)+\frac{u*\cos(e+d+a/2)-v*\sin(e+d+a/2)}{-\sin(a)}*-\cos(e+a/2)$$

$$\displaystyle r = \frac{b*\cos(a/2)}{\sin(a)}$$

what is u,v,a for $x=x_1$?
what is u,v,a for $y=y_1$?
what is u,v,a for $r=r_1$?

and the overlap of these answers would be the parameters that create my unique circle.

for $x_1$
$u_1=[...]$
$v_1=[...]$
$a_1=[...]$

for $y_1$
$u_2=[...]$
$v_2=[...]$
$a_2=[...]$

for $r_1$
$u_3=[...]$
$v_3=[...]$
$a_3=[...]$

then I would:

$u_1=u_2=u_3=u$
$v_1=v_2=v_3=v$
$a_1=a_2=a_3=a$

Do you think that would work?

Last edited:

#### theHeavyLobster

ditched the parameter d

So I chose to get rid of $d$ as it is 0 in this case and simplified the function to the following one:

$$\displaystyle \begin{bmatrix} x \\ y \\ \end{bmatrix} = \binom{u/2}{v/2}+\binom{v}{u}*\frac{1+cos(a)}{2*sin(a)}$$

$$\displaystyle \begin{bmatrix} r \end{bmatrix} = \frac{b*cos(a/2)}{sin(a)}$$

I'll try to inverse that now, any help is appreciated as always.

#### romsek

Math Team
So I chose to get rid of $d$ as it is 0 in this case and simplified the function to the following one:

$$\displaystyle \begin{bmatrix} x \\ y \\ \end{bmatrix} = \binom{u/2}{v/2}+\binom{v}{u}*\frac{1+cos(a)}{2*sin(a)}$$

$$\displaystyle \begin{bmatrix} r \end{bmatrix} = \frac{b*cos(a/2)}{sin(a)}$$

I'll try to inverse that now, any help is appreciated as always.
There's a bunch of conditions but a quick inverse of this is

\Large \begin{align*} &u = \frac{\sqrt{4 r^2-b^2}}{b}+2 y \\ \\ &v = \frac{2 b \sqrt{4 r^2-b^2} (x-y)+b^2-4 r^2}{b^2-4 r^2}\\ \\ &a = 2 \left(\tan^{-1}\left(-\frac{\sqrt{4 r^2-b^2}}{r},\frac{b}{r}\right)\right) \end{align*}

The $\tan^{-1}(x,y)$ function being used here takes two arguments, the first treated as the x-coordinate, and the second is the y coordinate and returns the angle in the proper quadrant.

See if these formulas work for you.

3 people

#### theHeavyLobster

I'll check those thanks, for a I did get:

a = 2*Asin(b/2r)

which seems to work

#### theHeavyLobster

\Large \begin{align*} &u = \frac{\sqrt{4 r^2-b^2}}{b}+2 y \\ \\ &v = \frac{2 b \sqrt{4 r^2-b^2} (x-y)+b^2-4 r^2}{b^2-4 r^2}\\ \\ &a = 2 \left(\tan^{-1}\left(-\frac{\sqrt{4 r^2-b^2}}{r},\frac{b}{r}\right)\right) \end{align*}
So, I tried plugging these into f(u,v,a) but the result is not the circle x,y,r. In other words, it doesn't work. I rewrote the formulas 2 times, always with the same result. I also tried to figure the inverse out myself and think I've got it right ideawise:

I had "a" figured out for "r" already, so I just plugged it into "x" and "y":

$$\displaystyle a = 2*sin^{-1}(b/2*r) \\$$

$$\displaystyle x = \frac{u}{2} + v* \frac{1+cos(a)}{2*sin(a)} \\$$

$$\displaystyle x = \frac{u}{2} + v* \frac{1+cos(2*sin^{-1}(b/2*r))}{2*sin(2*sin^{-1}(b/2*r))} \\$$

$$\displaystyle u = \frac{x}{2} + v*\frac{1 \pm sqrt(1-(b/2*r)^2)}{-2b/r}$$

$$\displaystyle y = \frac{v}{2} + u* \frac{1+cos(a)}{2*sin(a)} \\$$

$$\displaystyle v = \frac{y}{2} + u*\frac{1 \pm sqrt(1-(b/2*r)^2)}{-2b/r}$$

Now I plugged "v" into "u":

$$\displaystyle u = \frac{x}{2} + (\frac{y}{2} + u*\frac{1 \pm sqrt(1-(b/2*r)^2)}{-2b/r} )*\frac{1 \pm sqrt(1-(b/2*r)^2)}{-2b/r}$$

Now I just need to get all the u's to the left and I've got the formula for u.
Is that correct? I did this already, but the result was also not working, although it almost works, which is, why I think there's probably a little mistake in the simplification-process, let me show you:

The green circle is fed directly by the parameters x,y,r and the red one goes through the inverse of f and f itself.

If you find any mistake, let me know

Last edited:

#### theHeavyLobster

it is working!

Alright, Now I've checked my approach another time and have seen a couple of mistakes, now it's a matter of simplifications again, but u,v & a are set!

Thanks for the help again!