# Turning the two solutions of a quadratic equation in a general solution

So while I was working on a project for uni, I came across this quadratic equation: $$t^2 + 2\tau t - 1 = 0$$ The solutions for this particular equation are: $$t_{1, 2} = \tau \pm \sqrt{\tau^2+1}$$ I also found somewhere on the internet that the solutions can be written as one single solution namely: $$t = \frac{sign(\tau)}{|\tau| + \sqrt{\tau^2+1}}$$ But I didn't quite understand how they got to that conclusion, is this something that can be done with every quadratic equation with two solutions or is it only for this particular equation?

Perhaps I should also mention that the equation always has a solution between -1 and 1 and that the solution with the sign function always gives the solution that is between -1 and 1.

(The aforementioned equation is an equation that is used to compute givens-rotations, don't know if it is of any importance for the solution of the equation)

• I don't see how this generalizes the solution. In the usage I'm familiar with, $\text{sign}(x)$ returns $+1$ for $x>0$, $-1$ for $x<0$, and $0$ for $x=0$. In that light, it seems like your "alternate" equation only gives a single value for whatever $\tau$ is (presumably a fixed/given value), not two. And even if there is something I'm overlooking, this does not seem at all any easier to use - arguably more painful - than the original solution you obtained. – Eevee Trainer Apr 24 at 10:17
• In this case the only solution of importance is the one that lies between -1 and 1, since I have to write these equations in Matlab it seemed to me like the "alternate" equation is easier and perhaps more efficient. I didn't want to "just" use the equation as I don't fully understand how they got to the solution. – mrMoonpenguin Apr 24 at 10:26

First, let's check if your proposed solution makes sense. Let $$\tau = 1$$, then $$t_{1,2} = 1\pm \sqrt{2}$$. If you are interested in the number with magnitude less than $$1$$, then we are looking for $$1-\sqrt2 <0$$ but your proposed solution gives us a positive number. Hence it can't be the right formula.

If $$\tau \ge 0$$, then we have $$\tau + \sqrt{\tau^2+1} \ge 1$$ and we have $$-1\le \tau - \sqrt{\tau^2+1}<0$$ by triangle inequality.

Similarly, if $$\tau \le 0$$, we have $$\tau -\sqrt{\tau^2+1} \le -1$$ and $$0 < \tau + \sqrt{\tau^2+1} \le 1$$ by triangle inequality as well.

Hence when $$\tau \ge 0$$, we want an expression of $$\tau - \sqrt{\tau^2+1}$$ and when $$\tau \le 0$$, we want an expression of $$\tau + \sqrt{\tau^2+1}$$.

That is we want an expression of $$\tau - sign(\tau)\sqrt{\tau^2+1}$$ with the convention that $$sign(0)$$ can take value of $$1$$ and $$-1$$.

\begin{align} \tau - sign(\tau) \sqrt{\tau^2+1} &= (\tau - sign(\tau) \sqrt{\tau^2+1} )\cdot \frac{(-\tau -sign(\tau) \sqrt{\tau^2+1} )}{(-\tau -sign(\tau) \sqrt{\tau^2+1} )} \\ &=\frac{-\tau^2+(\tau^2+1)}{-\tau - sign(\tau) \sqrt{\tau^2+1}} \\ &= \frac{1}{-\tau - sign(\tau)\sqrt{\tau^2+1}}\\ &= \frac{1}{-sign(\tau)|\tau|- sign(\tau)\sqrt{\tau^2+1}}\\ &=-\frac{sign(\tau)}{|\tau| + \sqrt{\tau^2+1}}\\ \end{align}

The formula differs by a sign.