The \emph{\index{inequality}inequality} $-5<2$ is true because -5 is to the left of 2 on the number line, or equivalently the difference $2-(-5)=7$ is \emph{positive} (strictly greater than zero).\footnote{If one wishes to say a number is positive or zero (i.e. $x\ge0$) one can use the term \emph{non-negative}.}  We can exchange both sides of the inequality if we flip the direction of the inequality.  So, using a \emph{greater than} sign ($>$) instead of the \emph{less than} sign we have  $2>-5$ which is also true.  In either case the pointy side of the inequality points to the smaller number and the open side points to the larger number.  Note that smaller and larger mean with respect to the position of the numbers on the number line, not the \emph{magnitude} of the numbers.  Thus $-5<2$ is true despite the fact that the magnitude of -5 (which is $|-5|=5$) is greater than the magnitude of 2 (which is $|2|=2$).

Just as in equations we often introduce a variable in an inequality, such as $x<5$\,.  The set of all $x$ that satisfy this inequality is the interval $(-\infty,5)$.  Inequalities can either be \emph{strict} ($<$ or $>$) or otherwise ($\le$ or $\ge$)\,.  Here $\le$ means ``less than or equal to''.  So writing $x\le 5$ is logically equivalent to
\[x<5\ \ \mbox{or}\ \ x=5\ .\]
If desired one can find those values satisfying the inequality $x\le5$ by solving the strict inequality and the equality separately and combining (taking the union of) the results.  In this simple example the set of $x$ satisfying the inequality is clearly $(-\infty,5]$\,.

When the variable is not already isolated on one side of the inequality one will want to \emph{solve} the inequality to find those values that make it true.  One often has to manipulate inequalities to isolate the variable $x$, to find those solutions.  When it comes to addition or subtraction, inequalities can be manipulated like equations.  So $x-5<0$ can be solved to get $x<5$ by adding 5 to both sides of the inequality.  This similar behaviour is also the same when we multiply or divide both sides of an inequality with a \emph{positive} number.  However when solving an inequality one has to be careful when multiplying or dividing by \emph{negative} numbers.  In that case one must remember to flip the direction of the inequality.  To see that this is necessary consider $x-5<0$ again.  We can legitimately subtract $x$ from both sides to get the equivalent inequality $-5<-x$.  Now, however if we multiply (or divide) both sides by -1 without flipping the inequality direction we would get $5<x$ which is wrong as we saw above that $x<5$ is the correct answer.  Thus when multiplying (or dividing) both sides of $-5<-x$ by the negative number $-1$ we must flip the inequality to get $5>x$ which is equivalent to the correct inequality $x<5$ we found above.

When reciprocating both sides of inequality care must also be taken.  If $2<5$ then we see that one must flip the inequality when reciprocating since $\frac{1}{2}>\frac{1}{5}$.  In general for $0<a<b$ (which means ``$0<a$ and $a<b$'', so $a$ and $b$ are both positive)\footnote{The notation $a<b<c$ reflects the \emph{transitive} nature of inequalities, that is if $a<b$ and $b<c$ then $a<c$ is also true.} one must flip the inequality:
\[0<a<b\ \ \ \Rightarrow\ \ \ 0<\frac{1}{b}<\frac{1}{a}\ .\]
This flipping also occurs if $a$ and $b$ are both negative ($a<b<0$).  If one of $a$ or $b$ is positive and the other is negative however then the inequality does not flip, since the sign of the reciprocal numbers will be the same sign as the original numbers and the initial inequality ordering is therefore maintained.

If our original inequality does not have a simple linear form for the variable (like $ax+b<0$) then solving the inequality is more work.  Consider solving the inequality involving a rational function such as
\[\frac{x^2+5x+6}{5-x}<0\ .\]
We can factor this into linear expressions:
\[\frac{(x+3)(x+2)}{5-x}<0\]
We are looking for those values of $x$ which make the left hand side of the inequality negative.  For a rational expression such as this, this means we must have an odd number of negative factors in the expression as a whole (numerator and denominator), which can happen in several ways, namely
\[\frac{(+)(+)}{(-)}\ \ \mbox{or}\ \ \frac{(+)(-)}{(+)}\ \ \mbox{or}\ \ \frac{(-)(+)}{(+)}\ \ \mbox{or}\ \frac{(-)(-)}{(-)} .\]
Each one of these expressions can contribute to the solution (since they are logically connected by ``or'').  Looking at the first possibility, $\frac{(+)(+)}{(-)}$, we require
\[x+3>0\ \ \mbox{and}\ \ x+2>0\ \ \mbox{and}\ \  5-x<0\ .\]
Solving each inequality shows this is equivalent to
\[x>-3\ \ \mbox{and}\ \ x>-2\ \ \mbox{and}\ \  x>5\ .\]
Now because these must all be true for a given solution $x$ (due to the ``and'') we can clearly simplify this logic.  We have the intersection of three intervals, namely
$(-3,\infty)\cap(-2,\infty)\cap(5,\infty)$
which just equals (by considering, for instance, the overlap of these intervals on the number line) the interval $(5,\infty)$.  In other words, if logically $x$ must be greater than -3 and -2 and 5 then it just must be greater than 5.  Sign analysis of the second possibility, $\frac{(+)(-)}{(+)}$, implies
\[x+3>0\ \ \mbox{and}\ \ x+2<0\ \ \mbox{and}\ \  5-x>0\ ,\]
or
\[x>-3\ \ \mbox{and}\ \ x<-2\ \ \mbox{and}\ \  x<5\ .\]
The overlap of these intervals is
\[(-3,\infty)\cap(-\infty,-2)\cap(-\infty,5)=(-3,-2)\ ,\]
so $-3<x<-2$.
The third option, $\frac{(-)(+)}{(+)}$, yields
\[x+3<0\ \ \mbox{and}\ \ x+2>0\ \ \mbox{and}\ \  5-x>0\ ,\]
or
\[x<-3\ \ \mbox{and}\ \ x>-2\ \ \mbox{and}\ \  x<5\ .\]
The overlap of these intervals,
\[(-\infty,-3)\cap(-2,\infty)\cap(-\infty,5)\ ,\]
contains no points (since the first two intervals have no overlap).  We can write this ``solution'' using the empty set $\varnothing$ which we recall is defined to be $\{~\}$.  The final possibility, $\frac{(-)(-)}{(-)}$ implies
\[x+3<0\ \ \mbox{and}\ \ x+2<0\ \ \mbox{and}\ \  5-x<0\ ,\]
or
\[x<-3\ \ \mbox{and}\ \ x<-2\ \ \mbox{and}\ \  x>5\ .\]
These intervals again have no common solution,
\[(-3,\infty)\cap(-\infty,-2)\cap(5,\infty)=\varnothing\ .\]

Putting together the four possibilities we get the complete solution to the inequality which is the union of the intervals (since they are logically connected by ``or'') namely
\[(5,\infty)\cup(-3,-2)\cup\varnothing\cup\varnothing\]
which simplifies to
\[(-3,-2)\cup(5,\infty)\ .\]
Alternatively, using set theory notation, the solution is
\[\{x\in\mathset{R}\,|\,-3<x<-2\ \ \mbox{or}\ \ 5<x\}\ .\]
The above sign analysis can be expedited by first tabulating where each linear factor is positive and negative:
\begin{center}
\begin{tabular}{ccc} \\ \toprule
Factor & Positive on & Negative on \\ \midrule
$x+3$ & $(-3,\infty)$ & $(-\infty,-3)$ \\
$x+2$ & $(-2,\infty)$ & $(-\infty,-2)$ \\
$5-x$ & $(-\infty,5)$ & $(5,\infty)$
\end{tabular}
\end{center}
and then intersecting the intervals required for each sign combination.
 
If our original inequality had instead been
\[\frac{x^2+5x+6}{5-x}\le0\ ,\]
then we would have also had to include the solutions to
\[\frac{(x+3)(x+2)}{5-x}=0\ ,\]
namely where the numerator vanishes, $x=-3$ or $x=-2$.  Our solution would then have to include these interval endpoints, namely
\[[-3,-2]\cup(5,\infty)\ ,\]
or
\[\{x\in\mathset{R}\,|\,-3\le x\le-2\ \ \mbox{or}\ \ 5<x\}\ .\]
Note that $x=5$ is not included; the left hand side of the inequality is undefined there.

If our inequality had been
\[\frac{x^2+5x+6}{5-x}>0\ ,\]
then we could again do sign analysis, this time requiring an even number of negative factors to produce a positive expression.  In our example above this is:
\[\frac{(+)(+)}{(+)}\ \ \mbox{or}\ \ \frac{(-)(-)}{(+)}\ \ \mbox{or}\ \ \frac{(-)(+)}{(-)}\ \ \mbox{or}\ \frac{(+)(-)}{(-)}\ .\]
Using our earlier linear factor table we have immediately that the solution is
\begin{multline*}
[(-3,\infty)\cap(-2,\infty)\cap(-\infty,5)] \cup[(-\infty,-3)\cap(-\infty,-2)\cap(-\infty,5)]\\
\cup[(-\infty,-3)\cap(-2,\infty)\cap(5,\infty)] \cup[(-3,\infty)\cap(-\infty,-2)\cap(5,\infty)]\, 
\end{multline*}
which simplifies to
\[(-2,5)\cup(-\infty,-3)\cup\varnothing\cup\varnothing=(-\infty,-3)\cup(-2,5)\ ,\]
or
\[\{x\in\mathset{R}\,|\,x<-3\ \ \mbox{or}\ \ -2<x<5\}\ .\]
Since being greater than zero is the complement\footnote{The \textbf{\index{complement}complement} of a set $A$ is the set $U-A$ where $U$ is the \emph{universal set} of elements under consideration.  Usually $U$ will be \mathset{R} if we are considering real numbers, but in this case $U$ is those values for which the inequality can be evaluated, namely the domain of the rational function.  The complement of a set $A$ is sometimes denoted $A'$, $A^c$, $\bar{A}$ or $\tilde{A}$\,.} of being less than or equal to zero we can confirm this result, by taking the complement of our previous $\le$ solution,
 \[[-3,-2]\cup(5,\infty)\ ,\]
to get 
\[(-\infty,-3)\cup(-2,5)\ \]
for our greater than solution.
Once again, $x=5$ must be excluded when taking the complement as that value is not in the domain of the rational function.

As an alternative approach to the above procedure, one can analyze the inequality 
\[\frac{x^2+5x+6}{5-x}<0\]
by looking at those locations where the rational function $f(x)=\frac{x^2+5x+6}{5-x}$ can potentially change sign.  In places where $f(x)$ is continuous this can only occur only if $f(x)=0$.  Graphically speaking, the curve $y=f(x)$ crosses the $x$-axis ($y=0$) to go from negative to positive or vice versa.  If there is a discontinuity in the curve at a point $x$, say where the function $f(x)$ is undefined, then a change in sign of $f(x)$ can potentially occur there as well.  So in the above example we have that
\[f(x)=\frac{x^2+5x+6}{5-x}=\frac{(x+3)(x+2)}{5-x}\]
equals zero when the numerator vanishes, namely when factors $x+3=0$ or $x+2=0$, or simply when $x=-3$ or $x=-2$.  The function is undefined when the denominator vanishes, so $5-x=0$ (or $x=5$).  These three values of $x$ partition the real axis into four open intervals, namely $(-\infty,-3)$,$(-3,-2)$, $(-2,5)$, and $(5,\infty)$\,.  On each of these intervals, by our previous argument, the function must be either positive ($f(x)>0$) or negative ($f(x)<0$).  To determine which, we can take a convenient \emph{test value} within each interval and find the sign of $f$ at that point.  So, for instance, on $(-\infty,-3)$ we find that $f(-4)=\frac{2}{9}>0$ so the function is positive on that interval. A summary of the analysis of all the intervals is on the following table.
\begin{center}
\begin{tabular}{crrcc} \\ \toprule
Interval & Test Point & $f(x)$ & Sign $f(x)$ & Interpretation \\ \midrule
$(-\infty,-3)$ & $-4$~~~~~ & $\frac{2}{9}$ & $+$ & $f$ positive on interval \\[.3em]
$(-3,-2)$ & $-\frac{5}{2}$~~~~~ & $-\frac{1}{30}$ & $-$ & $f$ negative on interval \\[.3em]
$(-2,5)$ & $0$~~~~~ & $\frac{6}{5}$ & $+$ & $f$ positive on interval \\[.3em]
$(5,\infty)$ & $6$~~~~~ & $-72$ & $-$ & $f$ negative on interval
\end{tabular}
\end{center}
From this we see that $\frac{x^2+5x+6}{5-x}<0$ has solution $(-3,-2)\cup(5,\infty)$ as before while $\frac{x^2+5x+6}{5-x}>0$ has solution $(-\infty,-3)\cup(-2,5)$.  Finally if the inequality is not strict (so $\le$ or $\ge$) we have to include solutions to the equation $f(x)=0$ (here $x=-3$ or $x=-2$) in our solution, which, as before, are endpoints which close some of these intervals.

Either of the previous procedures rely on writing the expression $f(x)$ as a rational expression so that we have a product and/or quotient of factors.  To do this one might need to get a common denominator.  For instance to solve the inequality
\[\frac{2x^2+6}{5-x}+x<0\]
we can multiply the second term by $\frac{5-x}{5-x}$ to rewrite the left hand side as
\[\frac{2x^2+6}{5-x}+\frac{x(5-x)}{5-x}\ <0\]
which simplifies, upon expanding and combining the numerators, to
\[\frac{x^2+5x+6}{5-x}<0\ ,\]
which can be solved as before to get $x$ in $(-3,-2)\cup(5,\infty)$.

In general if we do not have zero on both sides of the inequality, we can use the rules given previously to rewrite the inequality with $f(x)$ on one side and $0$ on the other.  So for, instance, if we had to solve
\[x<\frac{2x^2+6}{x-5}\]
we could subtract the right side from both sides to get
\[-\frac{2x^2+6}{x-5}+x<0\]
Bringing the minus sign into the denominator of the first term, 
\[-1\cdot\frac{2x^2+6}{x-5}=\frac{1}{-1}\cdot\frac{2x^2+6}{x-5}=\frac{1(2x^2+6)}{-1(x-5)}=\frac{2x^2+6}{5-x}\ ,\]
our inequality becomes
\[\frac{2x^2+6}{5-x}+x<0\, \]
which we solved above to get $(-3,-2)\cup(5,\infty)$\,.

Note however, that while adding and subtracting an expression involving $x$ does not modify the inequality, multiplying or dividing by such an expression requires care.  For instance if we wanted to solve the inequality
\[x(x-5)<2x^2+6\, \]
then the easiest way to do so is to expand the left hand side and subtract it from both sides to get the equivalent inequality
\[0<2x^2+6-(x^2-5x)\]
or more simply
\[0<x^2+5x+6\ .\]
Factoring the right hand side gives
\[0<(x+3)(x+2)\]
which, upon sign analysis (so $(-)(-)$ or $(+)(+)$\,) results in the solution $(-\infty,-3)\cup(-2,\infty)$.  But suppose instead we started again with
\[x(x-5)<2x^2+6 \]
but wanted to divide both sides by $(x-5)$.  Since $(x-5)$ could be positive or negative this would now require us to solve two problems, as we can have solutions from 
\[x<\frac{2x^2+6}{x-5}\ \ \mbox{and}\ x-5>0\ ,  \]
as well as (``or'')
\[x>\frac{2x^2+6}{x-5}\ \ \mbox{and}\ x-5<0\ .  \]
The first inequality, $x<\frac{2x^2+6}{x-5}$, has, as we have seen, the solutions $(-3,-2)\cup(5,\infty)$.  Requiring $x-5>0$ (so $x>5$) means intersecting this with $(5,\infty)$ to get only $(5,\infty)$.  The second inequality, $x>\frac{2x^2+6}{x-5}$, has solution $(-\infty,-3)\cup(-2,5)$\,.  Requiring $x-5<0$ (so $x<5$) means intersecting this with $(-\infty,5)$ to get $(-\infty,-3)\cup(-2,5)$\,. Putting both possibilities together we get
\[(-\infty,-3)\cup(-2,5)\cup(5,\infty)\ .\]
Finally, we should notice that $x=5$ was also a solution to the original inequality.  (It got lost when we divided both sides by $x-5$.)  If we add this to our solution we do, finally, get
\[(-\infty,-3)\cup(-2,\infty)\]
as we found the easy way.  The point of this last example is that multiplying or dividing both sides of an inequality by expressions involving a variable is non-trivial and requires some bookkeeping.  Expressions having a constant sign (like $x^2+1$ which is always positive) would be an exception to this.

Once an inequality is solved it should be checked by choosing some test values from the solution (to see that they satisfy the inequality) and some values that are not part of the solution (to see that they do not). Graphing the non-zero side of the inequality can be done to check many values at once.

\begin{exercise}
\input{INEQUALITIES/solving-inequalities}
\end{exercise}

% TODO: We should add a line about the factor analysis approach being in general
% more rigorous but the test point method can be more usefule when you
% have a trig function like (x+3)(sin x)/(5-x) since w now need to consider
% the signs of the trig function etc.  Given continuity of f the test point
% method is rigorous too.  Test points work because if the function is
% continuous on an open interval and never zero it can't have points with two
% different signs because then there would be (by the IVT) a point with
% f(x)=0, a contradiction.  Thus finding locations of discontinuity where
% f(x)=0 is sufficient to break axis into intervals on which f is the same sign.
% This info should perhaps be added as a footnote since the reader is
% directed to the appendix before the IVT is introduced.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:
