# Please solve for X

I messed up the equation last time I asked this - Can someone please solve this function for X?

$Y = \displaystyle 0.5\:a\:\text{erf}\left(\frac{x-b}{c\sqrt{2}}+.5\right)+d$

When I solve for Y with x=1 and

a =       1.412
b =       1.259
c =       1.003
d =      0.3016


I get 0.5460

I want to plug 0.5460 into a formula and get 1 back.

I am aware that there exists a function called "inverse error function" (erfinv) where erfinv(erf(x)) = x but I still can't figure this one out.

-
@El`endia Thanks for the edit :) – Mike Furlender May 11 '11 at 22:19
You're welcome. :) – El'endia Starman May 11 '11 at 22:31
possible duplicate of How can I solve this equation (contains error function) ? – J. M. May 12 '11 at 1:10

As in the previous question, you just "unpack" it. $$Y-d=0.5a\text{ erf} \left(\frac{x-b}{c\sqrt{2}}+.5\right)$$
$$2\frac{Y-d}{a}=\text{erf}\left(\frac{x-b}{c\sqrt{2}}+.5\right)$$
$$\text{erf}^{-1}\left(2\frac{Y-d}{a}\right)-.5=\frac{x-b}{c\sqrt{2}}$$
$$c\sqrt{2}\left[\text{erf}^{-1}\left(2\frac{Y-d}{a}\right)-.5\right]+b=x$$

-

I do not know how familiar you are with basic algebra, so I will do it step by step. Please feel free to hurry the process!

$1$. Subtract $d$ from both sides. You should get

$$Y-d=(0.5a)\text{erf}\left(\frac{x-b}{c\sqrt{2}}+ 0.5\right)$$

$2$. Divide both sides by $0.5a$. You should get

$$\frac{Y-d}{0.5a}=\text{erf}\left(\frac{x-b}{c\sqrt{2}}+ 0.5\right)$$

Now for brevity let

$$w=\frac{Y-d}{0.5a}$$

So we have

$$w=\text{erf}\left(\frac{x-b}{c\sqrt{2}}+ 0.5\right)$$

$3$. Now apply $\text{erfinv}$ to both sides. This is where we use the fact that $\text{erfinv}(\text{erf}(u))=u$. We get

$$\text{erfinv}(w)= \left(\frac{x-b}{c\sqrt{2}}+ 0.5\right)$$

$4$. Subtract $0.5$ from both sides. We get

$$\text{erfinv}(w)-0.5= \left(\frac{x-b}{c\sqrt{2}}\right)$$

$5$. Multiply both sides by $c\sqrt{2}$. We get

$$c\sqrt{2}(\text{erfinv}(w)-0.5)= {x-b}$$

$6$. Finally, add $b$ to both sides, and because I like $x$ on the left of the $=$ sign, interchange the two sides. We get

$$x= c\sqrt{2}(\text{erfinv}(w)-0.5) +b$$

-