2
$\begingroup$

We know that if $ax^2+bx+c=0$ with $a\ne0$, then the solution(s) can be given by the quadratic formula $x=\frac{-b \pm \sqrt{b^2-4ac}}{2a}$.

But what if we want to solve a quadratic inequality such as $ax^2+bx+c>0$?

First, if $ax^2+bx+c$ can be factored into $(x+p)(x+q)$, then we have $(x+p)(x+q)>0$, so we know:

  1. Both $(x+p)$ and $(x+q)$ are positive; or,
  2. Both $(x+p)$ and $(x+q)$ are negative.

For the first case, we have $(x+p)>0$ and $(x+q)>0$, which simplify to $x>-p$ and $x>-q$, which is just $x>\max\{-p,-q\}$.

For the second case, we have (x+p)<0 and (x+q)<0, which simplify to x<-p and x<-q, which is just x<\min\{-p,-q\}.

So the final answer is just x\in\{x:x>\max\{-p,-q\}\text{ or }x<\min\{-p,-q\}\}.

Next suppose $\sqrt{b^2-4ac}$ is imaginary. Then we have two cases:

  1. $a>0$ so that the graph of $f(x)=ax^2+bx+c$ is completely above the $x$-axis. Then all real numbers are solutions to $ax^2+bx+c>0$.
  2. a<0 so that the graph of $f(x)=ax^2+bx+c$ is completely below the $x$-axis. Then no real number is a solution.

Now suppose $ax^2+bx+c$ does not factor. Then "force-factor" using the quadratic equation into $(x-\frac{-b + \sqrt{b^2-4ac}}{2a})$ and $(x-\frac{-b - \sqrt{b^2-4ac}}{2a})$ and repeat the steps above. Another way to think about this: since we are guaranteed that $\sqrt{b^2-4ac}$ is real (we took care of the imaginary cases already), we can divide the real number line into three intervals: $(-\infty,\frac{-b - \sqrt{b^2-4ac}}{2a})$, $(\frac{-b - \sqrt{b^2-4ac}}{2a},\frac{-b + \sqrt{b^2-4ac}}{2a})$, and $(\frac{-b + \sqrt{b^2-4ac}}{2a},+\infty)$ (or the other way round if a<0). Then check some number in each interval, and if that number is greater than $0$, then include that entire interval in the final answer. Otherwise don't include it. We can also do this by taking the outer two intervals when $a>0$ and taking the middle interval when a<0 (I think).

Questions: (1) Is this approach correct? (2) If so, is there a more efficient way to do it, i.e., how might one go about programming an algorithm for this type of problem?

  • 0
    This is not a homework question. I was only considering real solutions, but I suppose complex solutions would also be okay.2012-04-18

4 Answers 4

4

\text{If }~ f>0 ~\text{then}~ \begin{cases} x \in(-\infty,x_1) \cup (x_2,+\infty), & \text{if } a>0 ~\text{and}~ D>0 \\ x \in (x_1,x_2), & \text{if } a<0 ~\text{and}~ D>0 \\ x \in \mathbb{R}, & \text{if } a>0 ~\text{and}~ D < 0 \\ x \in \mathbb{R} \backslash \{x_{1,2}\} ,& \text{if } a>0 ~\text{and}~ D = 0 \\ x \in \emptyset & \text{if } a<0 ~\text{and}~ D \leq 0 \end{cases}

where $x_{1,2}$ are solutions of $ax^2+bx+c=0$ , and $D=b^2-4ac$

  • 0
    @russell11 I don't see any ellipsis .2012-04-18
1

The decision procedures you outline are good general purpose methods to answer this question. The important concept for quadratics is the discriminant, $\Delta=b^2-4ac.$ Its sign, together with the sign of $a$ (which tells you the behavior as $x\to\pm\infty$) tells you how the graph behaves relative to the $x$ axis, i.e. how many crossings it has ($\operatorname{sign}(\Delta)+1$). @pedja gives a great synopsis of this! In particular, $f(x)=ax^2+bx+c$ factors over $\mathbb{R}$ iff $\Delta\ge0$, in which case your $p,q$ are the negatives of the roots. Even when $\Delta<0$, we can still factor $f$ over the complex numbers $\mathbb{C}$, an algebraically closed field and the completion of $\mathbb{R}$. For example: $ \matrix{ \left.\matrix{ x^2+1=(x+i)(x-i)\\\\ x^2-x+1= \left(x-\tfrac{1+i\sqrt3}{2}\right) \left(x-\tfrac{1-i\sqrt3}{2}\right) }\right\}\qquad&\text{for }~\Delta<0 \\\\ \left.\matrix{ x^2-1=(x+1)(x-1)\\\\ x^2-x-1= \left(x-\tfrac{1+\sqrt5}{2}\right) \left(x-\tfrac{1-\sqrt5}{2}\right) }\right\}&\qquad\text{for }~\Delta>0 \\\\ \left.\matrix{ x^2+2x+1=(x+1)^2 }\right\}&\qquad\text{for }~\Delta=0 }$ I usually therefore (for didactic rootfinding and graphing purposes) write the factorization $(x-p)(x-q)$ since then $p$ and $q$ are just the roots. This also generalizes nicely for higher degree polynomials and their quotients, so-called rational functions. Ordering the roots (sorting them by numeric value, in programming talk) and knowing their degree then makes the function easy to sketch.

For the case of two polynomials in several variables over the integers, the problem is quite a bit harder.

1

You don't have to think of 'force-factoring' as different from normal factoring. It is what factorization gives us, if the discriminant is the square of a rational number the roots are rational and so the factorization may feel more 'natural', but the formula is the same in all cases. This approach is obviously correct, to program an algorithm you would first look at the determinant and if it is negative you will return the whole of the real line if a is positive or nothing otherwise. Else you would look at the three intervals you pointed out. If a is positive then the solution includes the first and the third of the intervals (i.e. those that contain $\pm \infty$). Else it is the second interval (between the two roots of the equation).

As far as I can make out, the major optimization you did not mention in the question is using the fact that if a is positive, then the expression goes to $\infty$ as x goes to $\pm \infty$, and if a is negative, then the expression goes to $- \infty$ as x goes to $\pm \infty$. Also, the expression changes signs at its roots.

0

We first define the following:-

  1. The quadratic function, f(x) = $ax^2+bx+c$
  2. The graph of $f(x)$, $y = f(x)$
  3. The quadratic equation, $f(x) = 0$
  4. The quadratic inequality,$ f(x) >0$
  5. The discriminant, $D = \sqrt{b^2-4ac}$ of $f(x) = 0$
  6. The modified quadratic function, $g(x) = f(x)/a$

Before actually solving $f(x) > 0$, we need the following assumptions/knowledge:-

  1. $a$’ should not be $0$ for the inequality to be quadratic. Thus, $a < 0$ or $a > 0$.
  2. By symmetry, we need only to discuss the case of $a > 0$.
  3. $y = f(x)$ is U-shaped and opens (concaves) upward.
  4. $y = f(x)$ is symmetrically about $x = -b/[2a]$
  5. $y = f(x)$ has a minimum at $(-b/[2a], f(-b/[2a])$

Case 1:- If $D < 0$,

-Conclusion #1, $f(x) = 0$ will have no real root; followed by

-Conclusion #2, $y = f(x)$ will never cross the x-axis (graphically); followed by

-Conclusion #3, $y = f(x)$ is called positive definite; i.e. $f(x) > 0$ for all x.

Case 2:- If $D = 0$,

-Conclusion #1, $f(x) = 0$ has equal roots ($t$, say); followed by

-Conclusion #2, $y = f(x)$ touches the x-axis at $x = t$ (graphically); followed by

-Conclusion #3, $x < t$ or $x > t$ are solutions to $f(x) > 0$.

Case 3:- If $D > 0$,

-Conclusion: $g(x) = 0$ has 2 real roots (p and q, say) and wlog, we can assume $p < q$.

Actions to be taken:-

  1. Locate $(-b/[2a], f(-b/[2a])$, the minimum point of $y = f(x)$.

  2. On the x-axis, mark off the points $(p, 0)$ and $(q, 0)$.

  3. Draw a U-shaped, opening upward, symmetrically about $x = -b/[2a]$ graph that passes through $(p, 0)$ and $(q, 0)$.

  4. The solution is all x that satisfies $y = f(x) > 0$, and these x’s are $x < p$ or $x > q$ because they all cause $y = f(x) > 0$.