# Why is the '+' solution to the quadratic formula always the one that satisfies my constraint

Let $A,B \in (0,1)$ be known constants, and $C \in (-\infty, \infty)$ be a known constant. Define

\begin{equation} \xi(x) = \log \big( x \big) + \log \big( 1+x-A-B \big) - \log \big( A - x \big) - \log \big( B - x \big) - C \end{equation}

For a particular application I need to find the root of $\xi(x)$ that satisfies:

\begin{equation} {\rm max}\Big(0, A+B-1\Big) \le x \le {\rm min}\Big(A,B\Big). \end{equation}

Some simple manipulation shows that the roots of $\xi(x)$ are also the roots of this quadratic equation:

$$(1-e^{C}) x^{2} + \Big(1 - A(1-e^{C}) - B(1-e^{C}) \Big)x - ABe^{C}$$

Which is easily solved with $a=(1-e^{C})$, $b=\Big(1 - A(1-e^{C}) - B(1-e^{C}) \Big)$, and $c=- ABe^{C}$. Comparing these solutions with numerical ones using bisection (with the bracket specified by the contraint above), I find that the solution always coincides with the '+' one of the two solutions to the quadratic equation. Any indication on how to show that analytically?

Assuming $C\neq0$ (since otherwise there is no quadratic equation and your question doesn't arise), we can divide through by $1-\mathrm e^C$, and the quadratic equation becomes

$$x^2+\left(\frac{1}{1-\mathrm e^C}-A-B\right)x-\frac{AB\mathrm e^C}{1-\mathrm e^C}=:x^2+px+q=0\;.$$

Assuming that you labeled the solutions as '$+$' and '$-$' according to the formula for the full quadratic equation, the sign of the square root is reversed if the coefficient we're dividing through by, $1-\mathrm e^C$, is negative, that is if $C>0$. Thus, for the reduced formula with $p$ and $q$, we need to show that for $C<0$ the '$-$' solution violates the bounds and for $C>0$ the '$+$' solution violates the bounds.

Now for $C<0$ we have $1/(1-\mathrm e^C)>1$, and thus $-p<A+B-1$ and $q<0$, and hence

$$-\frac p2-\sqrt{\frac{p^2}4-q}<-\frac p2-\sqrt{\frac{p^2}4}\le-\frac p2-\frac p2=-p<A+B-1\le\max(0,A+B-1)\;,$$

whereas for $C>0$ we have $1/(1-\mathrm e^C)<0$, and hence

$$-\frac p2+\sqrt{\frac{p^2}4-q}\ge-\frac p2\ge\frac{A+B}{2}\ge\min(A,B)\;.$$

Thus, the solution that has a '$-$' in the formula for the full quadratic equation always violates one of the bounds.

• let $A = .4$, $B = .1$, $C = 2$. Then, $p = 1/(1-e^2) - .4 - .1 \approx -.656$. Also, $q = - .4 \cdot .1 \cdot e^{2}/(1 - e^{2}) \approx .046$. So, $-p/2 - \sqrt{ p^{2}/4 - q } \approx .079 > 0$. which directly disagrees with your last line. Am I making a mistake? – Macro Jul 3 '11 at 2:04
• Also, yes, when $C=0$, the answer reduces to $AB$, which makes perfect sense in the context of the application. – Macro Jul 3 '11 at 2:06
• In fact, I'm actually finding numerically that the '-' solution violates the upper bound sometimes and the lower bound sometimes. – Macro Jul 3 '11 at 2:11
• @Macro: You're right, I got the signs mixed up in the case $C>0$. But I don't understand your last comment: If the '$-$' solution sometimes violates the upper bound, how can the '$+$' solution, which is always greater than the '$-$' solution, always fulfil the constraints? Or is that not what you were saying in the question? – joriki Jul 3 '11 at 2:27
• The '+' solution doesn't have to be larger than the '-' solution. For example, $A=.2$, $B=.6$, $C=.1$ (using the notation in the original post). It depends entirely on the sign of $C$, which is a useful observation I've just now made. – Macro Jul 3 '11 at 2:29