UMM Calculus 1.
Functions and Their Graphs

Byungik Kahng and Michael O'Reilly

Abstract.  In the first three sections, we review the prerequisite materials and provide the glossary of terms and notations that will be used in the future.  Section 4 is devoted to various Mathematica commands on plotting the graphs of functions.  Students with sound background in precalculus may skip the first three sections.

General Setup

Off[General::spell];
Off[General::spell1];
SetOptions[Limit, Analytic -> True];

Graphics Setup

2D setup

<< Graphics`Colors`;
<< Graphics`Graphics`;
<< Graphics`ImplicitPlot`;
<< Graphics`FilledPlot`;
<< Graphics`Animation`;

    
Begin["`Private`"];
SetOptions[ParametricPlot, 
        AspectRatio -> Automatic];
SetOptions[Plot, AspectRatio -> Automatic];
SetOptions[Graphics, AspectRatio -> Automatic];

3D setup

<< RealTime3D`;
MathView = {2.5, 2.0, 1.5};

Vector Setup

2D vectors

Options[Arrow] = {HeadRatio -> 0.15, Sharpness -> 0.25, 
          ShaftRatio -> 0.25};
Arrow[from_?VectorQ, to_?VectorQ, 
          opts___] := 
Module[{vector, vectorlength, 
              unitvector, perp, headratio, arrowbase, sharpness, shaftratio, 
              ii}, 
{headratio, sharpness, 
                shaftratio} = {HeadRatio, Sharpness, 
                    ShaftRatio} /. {opts} /. 
                Options[Arrow]; 
vector = 
              to - from; 
vectorlength = (Sqrt[N])[vector . vector]; 
If[vectorlength > 0, 
              unitvector = (vector/vectorlength), 
              unitvector = {0, 
                  0}]; 
perp = {unitvector[[2]], -unitvector[[1]]}; 
arrowbase = 
              from + (1 - headratio)*
                  vector; 
Flatten[{
Polygon[{to, 
                    arrowbase + (headratio*vectorlength*Tan[sharpness]) 
                        perp, 
arrowbase + (headratio*
                            shaftratio) 
                        vector, 
arrowbase - (headratio*
                            vectorlength*Tan[sharpness]) perp, 
                    to}], 
Line[{from, 
                    arrowbase + (headratio*shaftratio) 
                        vector}]
}]
] /; 
          Length[from] == Length[to] == 2;

3D vectors

Options[Arrow3D] = {HeadRatio -> 0.15, 
          Sharpness -> (π/12)};
Arrow3D[from_?VectorQ, to_?VectorQ, opts___]:=
Module[{vector, vectorlength, unitvector, tmpvector, 
                tmplength, , perp, biperp, headratio, arrowbase, arrowvertex, 
                sharpness, ii, jj, kk},
{headratio, 
                    sharpness} = {HeadRatio, Sharpness} /. {opts} /. 
                    Options[Arrow3D];
vector = to - from;
vectorlength = (Sqrt[N])[vector . vector];
If[vectorlength > 0, 
                  unitvector = (vector/vectorlength), 
                  unitvector = {0, 0, 0}];
tmpvector = {0, 
                    unitvector[[3]], -unitvector[[2]]};
tmplength = (Sqrt[N])[unitvector[[2]]^2 + unitvector[[3]]^2];
If[tmplength > 0, 
                  perp = (tmpvector/tmplength), perp = {0, 1, 0}];
biperp = 
                  N[Det[{{ii, jj, kk}, unitvector, 
                          perp}] /. {ii -> {1, 0, 0}, 
                        jj -> {0, 1, 0}, kk -> {0, 0, 1}}];
arrowbase = 
                  from + (1 - headratio)*vector;
arrowvertex = 
                  Table[arrowbase + (headratio*vectorlength*
                            Tan[sharpness]) (Cos[(π/4) ii] perp + 
                            Sin[(π/4) ii] biperp), {ii, 0, 8, 1}];
Flatten[{
Table[
Polygon[{to, 
                          arrowvertex[[ii]], 
                          arrowvertex[[ii + 
                                1]]}], 
{ii, 1, 8, 
                        1}], 
Line[{from, 
                        to}]
}]
]/;Length[from] == Length[to] == 3;

Vector fields

<< Graphics`PlotField`;
<< Graphics`PlotField3D`;

1.  Algebraic Preliminaries

Roughly speaking, a function is a rule to assign each element of one set to an element of another.  Therefore, the study of functions has two aspects: the properties of the sets, and the properties of the assignment.  The former aspect will be discussed in this section.  The remainder of calculus courses will be devoted to the latter aspect.

(1.1)  Set notation.

The set notation is useful when expressing mathematical statements.

1.1.1.  Sets and elements.

A set can be defined as a list of elements.  For instance,

S={3,6,9,12,⋯ }.

It can be defined by an explicit condition, too.

S={x|x is a multiple of 3}.

We use  ∈  to denote its elements and  ⊂  for subsets.

27∈S,  34 ∉ S,  {3, 30} ⊂ S,  {2, 33} ⊄ S.

Here are a couple of examples of sets.

1.1.2.  Sets of numbers.

({{ℕ, =, \(\(The\)\(\ \)\(set\)\(\ \)\(of\)\(\ \)\(Natural\)\(\ \)\(Numbers\)\(\ \ \)\)}, {𝕎, =, \(\(The\)\(\ \)\(set\)\(\ \)\(of\)\(\ \)\(Whole\)\(\ \)\(Numbers\)\(\ \ \ \ \)\)}, {ℤ, =, \(\(The\)\(\ \)\(set\)\(\ \)\(of\)\(\ \)\(Integers\)\(\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \)\)}, {ℚ, =, \(\(The\)\(\ \)\(set\)\(\ \)\(of\)\(\ \)\(Rational\)\(\ \)\(Numbers\)\(\ \)\)}, {ℝ, =, \(\(The\)\(\ \)\(set\)\(\ \)\(of\)\(\ \)\(Real\)\(\ \)\(Numbers\)\(\ \ \ \ \ \ \ \ \)\)}, {ℂ, =, The set of Complex Numbers}})

ℕ⊂𝕎⊂ℤ⊂ℚ⊂ℝ⊂ℂ

1.1.3.  Intervals.

[ a, b]   =   {x | a ≤ x ≤ b}
( a, b)   =   {x | a < x < b}
[ a, b)   =   {x | a ≤ x < b}
( a, b]   =   {x | a < x ≤ b}

The first is called a closed interval, the second is called an open interval.

(1.2)  Basic algebra.

1.2.1.  Equality.

Equality ( = ) means equality.  This is no joke.   =  must be used only when the left hand side and the right hand side are equal.

For instance, solve the following equation.

2  x + 1 = -3

Wrong solution.

2  x=-3 - 1=-4/2=-2.

Comment.  -3 - 1 is -4, not -2.

Correct solution.

2  
        x = -3 - 1 = -4

x = -4/2 = -2

1.2.2.  Parentheses.

Every parenthesis ends.  ( cannot stand alone.  Be sure to close it where it must be closed.

For example, let us consider

f(x) = (x^2) - 1  and   g(x) = (x^2) + 3  x - 2.

Simplify the expression,

f(x) - 3  g(x).

Wrong solutions.

(x^2) - 1 - 3 ((x^2) + 3  x - 2 = ⋯

(x^2) - 1 - 3  • (x^2) + 3  x - 
        2 = ⋯

(x^2) - 1 - 3  (x^2) + 9  x - 
        6 = ⋯

Comment.  Every parenthesis ends.

Correct solution.

(x^2) - 1 - 
      3 ((x^2) + 3  x - 2)

    =(x^2) - 1 - 3  (x^2) - 9  x + 6

    =-2 (x^2) - 9  x + 5

1.2.5.  Expansion and factorization.

Here are a couple of commonly used factorization formulae.

(((a ± b))^2)  =  (a^2) ± 
          2  a b + (b^2)
(a + b) (a - b)  =  
      (a^2) -  (b^2)

Here are a couple of common mistakes.

(((a ± b))^2)  ≠  
      (a^2) ±  (b^2)
\(TraditionalForm\`\@\(a ± b\)\  ≠ \ \@a ± \ \@b\)

Example 1.2.6.

Let

f(x) = (x^2) - 1.

(a)  Solve the following equation.

((f(x))^2) = (x^4) - 3  x

(b)  Solve the following equation.

(Sqrt[f(x)]) = 2

Wrong solutions.

(a)

((((x^2) - 1))^2) = (x^4) - 3  x

(x^4) - (1^2) = (x^4) - 3  x

-1 = -3 x

x = 3

(b)

(Sqrt[(x^2) - 1]) = 2

(Sqrt[(x^2)]) - (Sqrt[1]) = 2

x - 1 = 2

x = 3

Comment.  Addition and subtraction cannot be under square or square root.

Correct solutions.

(a)

((((x^2) - 1))^2) = (x^4) - 3  x

(x^4) - 2  x + 1 = (x^4) - 3  x

1 = -3 x + 2  x = -x

x = -1

(b)

(Sqrt[(x^2) - 1]) = 2

(x^2) - 1 = (2^2) = 4

(x^2) = 5

x = ±(Sqrt[5])

Example 1.2.7.

Solve the following quadratic equation.

(x^2) + 3  x + 2 = 6

Wrong solution.

(x^2) + 3  x + 2 = (x + 1) (x + 2)

x = -1,  x = 2.

Comment:  Factorization does not guarantee solution.  The key is to make the right hand side 0.

Correct solution.

(x^2) + 3  x + 2 = 6

(x^2) + 3  x - 4 = 0

(x + 4) (x - 1) = 0

The right hand side is 0, so either x + 4 = 0 or x - 1 = 0, because we cannot get 0 by multiplying two non-zero numbers.  Thus,

x = -4,  or  x = 1.

(1.3)  Intermediate Algebra.

1.3.1.  Expansion and factorization.

Here is a list of commonly used expansion-factorization formulae.

(((a ± b))^2)  =  (a^2) ± 
            2  a b + (b^2)
(a + b) (a - b)  =  (a^2) -  (b^2)
  
	(x + a) (x + b)  =  
        (x^2) + (a + b) x + a b
(a x + b) (c x + d)  =  
        a c (x^2) + (a d + b c) x + b d

Here are some more.

(((a ± b))^3) =  (a^3) ± 
          3  (a^2) b + 3  a (b^2) ± 
          (b^3)
 
    (a^3) ±  
        (b^3) =  (a ± b) ((a^2) ∓ a b + 
            (b^3))
(((a + b + c))^2) = 
      (a^2) + (b^2) + (c^2) + 2 (a b + b c + c a)

1.3.2.  The Factor Theorem.

Let f(x) be a polynomial with integer coefficients.  Let α be a zero of f(x).  That is, f(α) = 0.  Then (x - α) is a factor of f(x).  In other words,

f(
        x) = (x - α) g(x)

for some polynomial g(x), where the degree of g(x) is 1 less than the degree of f(x).

1.3.3.  The use of Mathematica.

Expand and Factor are used for expansion and factorization.  Simplify is used for simplification.

Clear[a, b, x]
Expand[(((x + 1))^2) (x - 2) (3  x + 
            1)]
Factor[3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2]

Solve or NSolve commands are used for equations.

Clear[x]
Solve[3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2 == 0, x]

Solve or NSolve can be used for a system of equation, too.

Clear[x]
Solve[{3  (x^2) - 3 - 8 y == 0, -3 (y^2) + 3 - 8 x == 
          0}, {x, y}]

Example 1.3.4.

Solve the following equation.

3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2 = 
      0

Solution 1.  (without computer)

Put

f(x) = 
      3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2

and apply the factor theorem.  We start guessing the roots from the divisors of 2.  That is, we try x = 1, -1, 2, -2.  We get,

f(-1) = 3 - 1 - 9 + 9 - 2 = 
          0.

Therefore, x = -1 is a root and (x + 1) is a factor of f(x).  Dividing (x + 1) from f(x) through the synthetic division, we get

g(x) = ((f(x))/(x  +  1)) = 
          3  (x^3) - 2  (x^2) - 7  x - 2.

We must apply the factor theorem again.  Again, we see g(-1) = 0.  The quotient is

((g(x))/(x  +  1)) = 3  (x^2) - 5  x - 2.

This time, we do not need the factor theorem, because the polynomial is only quadratic.  We can factorize it as

3  (x^2) - 5  x - 
          2 = (3  x + 1) (x - 2).

Hence, the original polynomial equation can be rewritten as,

f(x) = 3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2
          =(((x + 1))^2) (3  x + 1) (x - 
                    2) = 0.

Thus, we get the equation,

f(
          x) = (((x + 1))^2) (3  x + 1) (x - 2) = 0,

which has solutions, x = -1, 2, -1/3.

We got lucky this time, we were able to guess one of the roots (-1) and it turned out to be a double root (this means (x+1) shows up twice in the factoring).  There is of course no guarantee that we can always do this, but if the coefficients are nice numbers, like here, it may be worth a try.

Solution 2.  (with Mathematica)

Here is the solution.

Solve[3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2 == 0, x]

The problem did not ask you to factor the given polynomial, but you can still do it.

Factor[3  (x^4) + (x^3) - 9  (x^2) - 9  x - 2]

Anybody still doubts why we learn Mathematica?

How does Mathematica do it?  There exist formulas for solving quartic equations (which is the same problem as factoring a quartic polynomial in one variable) .  They are complicated, but Mathematica knows them.  There are no general formulas for solving equations of degree 5 and above.  There are some general principles that work if the coefficients are nice and Mathematica knows a few.

1.3.5.  Solving one variable with respect to the others.

Solving one variable with respect to the others is an important technique that is applied to various places.  Again, Solve and NSolve can be applied.

Clear[x, y]
Solve[y == ((2  x + 3)/(3  x - 1)), 
      x]
NSolve[y == ((2  x + 3)/(3  x - 1)), x]

Example 1.3.6.

Represent x in terms of y when the relationship between them are given as follows.

\(TraditionalForm\`\(\(\ \)\(y = \(2  x\  + \ 3\)\/\(3  x\  - \ 1\)\)\)\)

Solution.

Mathematica command for this problem is given in 1.3.5.  Here, we discuss only the traditional calculation method.  First, let us get rid of the denominator.

y(3  x - 1) = 2  x + 3

Now, we break up the parenthesis.

3  x y - y = 2  x + 3

Here is the key step.  Move all the x-terms to the left hand side and move the rest to the other side.

3  x y - 2  x = y + 3

The next step is to factor x out in the left hand side.

x(3  y - 2) = y + 3

The final step is straightforward now.

\(TraditionalForm\`\(\(\ \)\(x = \(y\  + \ 3\)\/\(3  y\  - \ 2\)\)\)\)

This technique will be used when finding inverse functions (3.3) among other uses.

Another typical use of 1.3.5 is the solution of systems of non-linear equations.

Example 1.3.7.

Solve the following system of quadratic equations.

3  (x^2) - 3 - 8 y = 0
 3  (y^2) - 3 + 8 x = 0

Solution 1.  (without computer)

From the first equation, we get

y = ((3  (x^2)  -  3)/8).

Plug this into the second equation and we get the following equation.

3 (((((3  (x^2)  -  3)/8)))^2) - 3 + 8  x = 0

Simplifying the above equation, we get the following quartic equation.

g(
        x) = 27  (x^4) - 54  (x^2) + 512  x - 165 = 0

It's time to brush up your precalculus skill.  If this equation has a rational root, that is one of form of \(TraditionalForm\`\(\(a/
          b\)\(\ \)\(where\)\(\ \)\(we\)\(\ \)\(assume\)\(\ \)\(a\)\(\ \)\(and\)\(\ \)\(b\)\(\ \)\(are\)\(\ \)\(in\)\(\ \)\(lowest\)\(\ \)\(terms\)\(\ \)\((that\ is\ they\ are\ relatively\ prime)\)\(\ \)\)\), then a must be a factor of 165, and b must be a factor of 27.  (Why? Try substituting a/b into the equation, then multiplying by (b^4). Now you can factor out a from every term but one, or b from every term but one.) Trying various numbers, you get

g(-3) = 0,   g(1/3) = 
      0.

Therefore, the polynomial g(x) is divisible by (x + 3) and (3  x - 1).  Applying synthetic division twice, you get

\(TraditionalForm\`\(27  x\^4\  - \ 54  x\^2\  + \ 512  x\  - \ 165\)\/\(\((x\  + \ 3)\) \((3  x - 1)\)\) = 9  x\^2 - 24  x + 55\)

The latter quadratic function has no real zero.  Hence, our solutions are

x = -3, +(1/3).

From the first equation,

y = ((3  (x^2)  -  3)/8).

Putting x = -3 and x = 1/3, we get y = 3 and y = -1/3, respectively.  Hence, the final (real) solutions are,

(x, y) = (-3, +3)  and  (x, y) = (+(1/3), -(1/3)).

Solution 2.  (with Mathematica)

Solve[{3  (x^2) - 3 - 8 y == 0, 
        3  (y^2) - 3 + 8 x == 0}, {x, y}]

Anybody still doubts UMM Calculus curriculum?

2.  Geometric Preliminaries

(2.1)  Lines.

2.1.1.  The equations of lines in a plane.

This is the general form of the equation of a line.

a x  +  b y  +  c  =  
      0

Only the general form can effectively represent vertical lines.  The rest of the formulae works for non-vertical lines.

The following equation is call the standard form.  It is also known as the slope-intercept form.

y  =  m x  +  b

The following equation is known as the slope-point form.  This is the most useful equation in Calculus I.

y  =  
      m (x  -  (Subscript[x, 0]))  +  (Subscript[y, 0])

When two points are given we use the following formula.

y  =  
        m(x  -  (Subscript[x, 1]))  +  (Subscript[y, 1]),   \(TraditionalForm\`\(\(\ \)\(m\  = \ \(y\_2\  - \ y\_1\)\/\(x\_2\  - \ x\_1\)\)\)\).

That is,

y  =  (((Subscript[y, 2])  -  (Subscript[y, 1]))/((Subscript[x, 2])  -  
                (Subscript[x, 1]))) (x  -  (Subscript[x, 1]))  +  (Subscript[y, 1])

2.1.2.  Parallel lines and perpendicular lines.

Two lines are parallel if their slopes are identical.  Two lines are perpendicular to each other if the product of their slopes is -1.

Example 2.1.3.

Find the equation of a line that runs through a point (1, 1) and parallel to y = (1/2) x.

Solution.

y  =  (1/2) (x - 1)  +  
        1

Plot[{(1/2) (x - 1) + 1, (1/2) x}, {x, -2, 2}, 
        PlotStyle -> {Blue, Red}];

(2.2)  Circles.

2.2.1.  The distance formula.

The distance between two points can be calculated by the following formula.  It can be derived easily from Pythagorean theorem.

\(TraditionalForm\`\(\(\ \)\(distance = \@\(\((x\_2 - x\_1)\)\^2 + \((y\_2 - y\_1)\)\^2\)\)\)\)

Clear[x1, y1, x2, 
      y2]
{x1, y1} = {1, 
          1};
{x2, y2} = {4, 
          2};
psize = 
        0.015;
ρ = 
        0.1;
triangleplot = 
        Graphics[{Blue, 
            Line[{{x1, y1}, {x2, y1}, {x2, 
                  y2}}]}];
hypplot = 
        Graphics[{Red, Thickness[0.005], 
            Line[{{x1, y1}, {x2, 
                  y2}}]}];
point1plot = 
        Graphics[{Blue, PointSize[psize], 
            Point[{x1, y1}]}];
point2plot = 
        Graphics[{Blue, PointSize[psize], 
            Point[{x2, y2}]}];
point0plot = 
        Graphics[{Black, PointSize[psize], 
            Point[{0, 0}]}];
rightangleplot = 
        Graphics[{Black, 
            Line[{{x2 - ρ, y1}, {x2 - ρ, y1 + ρ}, {x2, 
                  y1 + ρ}}]}];
Show[rightangleplot,triangleplot,hypplot,point1plot,point2plot,AspectRatio -> Automatic,PlotRange -> {{0, 5}, {0.5, 2.5}},
DisplayFunction -> $DisplayFunction,Epilog->{Text["((Subscript[(x), 1]), (Subscript[(y), 1]))",{x1 - 0.5, y1}],Text["((Subscript[(x), 2]), (Subscript[(y), 2]))",{x2 + 0.25, y2 + 0.25}],
Text["(Subscript[x, 2]) - (Subscript[x, 1])",{2.5, 0.75}],Text["(Subscript[y, 2]) - (Subscript[y, 1])",{x2 + 0.4, 1.5}],Text["dist",{2.5, 1.75}]
}];

2.2.2.   The equation of a circle in a plane.

A point, (x, y) in a circle is the same distance, r away from the center, ((Subscript[x, 0]), (Subscript[y, 0])).  Thus,  we must have (Sqrt[((((Subscript[x, 2]) - (Subscript[x, 1])))^2) + ((((Subscript[y, 2]) - (Subscript[y, 1])))^2)]) = 
        (r^2).  Consequently,

(((x - (Subscript[x, 0])))^2)  +  (((y - (Subscript[y, 0])))^2) = (r^2)

Clear[r, 
      t]
r = 
        1;
ρ = 
        0.1;
circleplot = 
        ParametricPlot[{r Cos[t], r Sin[t]}, {t, 0, 2  π}, 
          PlotStyle -> {Blue}, Axes -> False, 
          AspectRatio -> Automatic, 
          DisplayFunction -> 
            Identity];
centerplot = 
        Graphics[{Black, PointSize[0.025], 
            Point[{0, 0}]}];
lineplot = 
        Graphics[{Black, 
            Line[{{0, 0}, {-1/(Sqrt[2]), 1/(Sqrt[2])}}]}];
Show[lineplot,circleplot,centerplot,AspectRatio -> Automatic,DisplayFunction -> $DisplayFunction,
Epilog->{Text["((Subscript[(x), 0]), (Subscript[(y), 0]))",{0.25, 0}],Text["r",{-0.3, 0.4}]
}
];

(2.3)  Crossing points.

2.3.1.  Equations and curves.

An equation of x and y can often be represented as a curve.  For instance, the following curve depicts the relationship,

(x^3)  +  (y^3)  =  6  x y.

Clear[x, y]
ImplicitPlot[(x^3) + (y^3) == 6  x y, {x, -5.1, 3.2}, 
        PlotStyle -> {Blue}];

That is, the above curve stands for the set of points (x, y) that satisfy the relationship (x^3)  +  (y^3)  =  6  x y.

2.3.2.  Solutions and crossing points.

Since equations corresponds to curves, the solutions of a system of equations corresponds the crossing points between curves.  That is, a crossing point (x, y) satisfies all the equations in the system, because it belong to all the curves that arise from the system.  The following example elaborates this idea.

Example 2.3.4.

Solve the following system of equations and represent them graphically.

(x^3)  +  (y^3)  =  
      6  x y

     (x^2)  +  (y^2)  =  4

Solution.

Clear[x, y]
ImplicitPlot[{(x^3) + (y^3) == 6  x y, 
          (x^2) + (y^2) == 4}, {x, -5.1, 3.3}, 
        AspectRatio -> Automatic, PlotStyle -> {Blue, Red}, 
        PlotRange -> {{-3.5, 3.5}, {-3.5, 
              3.5}}];
NSolve[{(x^3) + (y^3) == 6  x y, (x^2) + (y^2) == 4}, {x, 
        y}]

As expected, there are four real roots.

3.  Functions

(3.1)  What is a function?

3.1.1.  What is a function?

Roughly speaking, a function is a process to assign each element of one set to one (and only one) element of another.  The former set is called the domain, the latter set is called the target.  We use the following mathematical statement to denote a function f, its domain D, and its range Y.

f : D -> Y

Let x be an element of D, which we shall call an original value.  Then the function f assigns x to an element in the target Y, which we will call the value of the function f at x, or simply the function value.  Traditionally, we denote the function value as f(x).  In the input cell, however, Mathematica requires the notation f[x] (f[x_] when defining the function).  Therefore, we will frequently use the notation f[x], as well as the traditional symbol, f(x).

3.1.2.  How to denote a function.

One can denote a function through verbal descriptions or a table.  Say,

(a)  f is a function that takes any real number, takes its square and take the negative, and then add 1.

(b)  Here is the table of the original values and the function values of f.

Clear[f, 
      x]
f[x_] = -(x^2) + 
          1;
entries = 
        Table[{x, f[x]}, {x, -2, 2}];
TableForm[entries,TableHeadings->{None,{"x","f(x)"}},TableAlignments -> Center]

There are problems, though.  The first method (a) is confusing and the second method (b) is incomplete.  Therefore, mathematicians prefer the following method when denoting a function.

(c)  \(TraditionalForm\`f : ℝ -> ℝ\) is a function given by the following equality.

f(x) = -(x^2) + 1

3.1.3.  Graphs.

The graph of a function f : D -> Y is the set of points,

{(x, y) | y = f(x), x ∈ D}

The basic syntax to graph a function is Plot[f[x],{x,a,b}], where f[x] is the function and {x,a,b} stands for the viewing interval, (a, b).

Plot[-(x^2) + 1, {x, -2, 2}];

We will learn more about graphs (with Mathematica) in the next section.

3.1.4.  Function or no function?

Recall that we described the concept of a function as a process to assign each element of one set to one (and only one) element of another.  That is for given x in the domain of f, no two distinct function values can be assigned.  This property is the key to the functional relationship.

Roughly speaking, you (a function) cannot be in two different places (values) at the same time.

Example 3.1.5.

Which of the following three plots represent the graph of a function?

Clear[x, y]
plot1 = 
        ImplicitPlot[(x^3) + (y^3) == 6  x y, {x, -5.1, 3.2}, 
          AspectRatio -> Automatic, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity];
plot2 = 
        ParametricPlot[{Cos[3  t], Sin[2  t]}, {t, 0, 2  π}, 
          AspectRatio -> Automatic, PlotStyle -> {Red}, 
          DisplayFunction -> Identity];
plot3 = 
        Plot[x Sin[(x^2)], {x, -π, π}, 
          AspectRatio -> Automatic, PlotStyle -> {DarkGreen}, 
          DisplayFunction -> Identity];
Show[GraphicsArray[{plot1, plot2, plot3}], 
        DisplayFunction -> $DisplayFunction];

Solution.

No x-coordinate value (the original value) must be assigned to more than one y-coordinate value (the function value).  Therefore, the answer is the third plot.  This idea is visualized in the following fashion.

Clear[x, y]
plot1 = 
        Show[ImplicitPlot[(x^3) + (y^3) == 6  x y, {x, -5.1, 3.2}, 
            AspectRatio -> Automatic, PlotStyle -> {Blue}, 
            DisplayFunction -> Identity], 
          Graphics[{Black, 
              Line[{{1, -5}, {1, 3}}]}]];
plot2 = 
        Show[ParametricPlot[{Cos[3  t], Sin[2  t]}, {t, 0, 2  π}, 
            AspectRatio -> Automatic, PlotStyle -> {Red}, 
            DisplayFunction -> Identity], 
          Graphics[{Black, 
              Line[{{0.5, -1}, {0.5, 
                    1}}]}]];
plot3 = 
        Show[Plot[x Sin[(x^2)], {x, -π, π}, 
            AspectRatio -> Automatic, PlotStyle -> {DarkGreen}, 
            DisplayFunction -> Identity], 
          Graphics[{Black, 
              Line[{{1, -2.5}, {1, 
                    2.5}}]}]];
Show[GraphicsArray[{plot1, plot2, plot3}], 
        DisplayFunction -> $DisplayFunction];

Note that the vertical line x = a crosses the first and the second plot multiple times, but it crosses the third plot just once.  This method is called the vertical line test.

(3.2)  Domain, range and image.

3.2.1.  More about domains.

Frequently we define a function without specifying its domain.  For instance, the function f given by

f(x) = (1/((x^2)  -  1))

does not make sense for all x.  When x = 1 or x = -1, the denominator turns 0, and f(x) cannot be defined.  In such a case we must find the domain of a function.  The set D (in ℝ) in which f(x) makes sense.

How to find the domain of a given function is an important topic in precalculus.

Example 3.2.2.

Find the domains of the following functions.

f(x) = 
      (1/((x^2)  -  1))

     g(x) = (Sqrt[(x^2) - 1])

     h(x) = Log[(x^2) - 1]

Solutions.

The denominator of f should not be 0.  Therefore,

(x^2) - 1 = (x + 1) (x - 1) ≠ 
        0, 
x ≠ 
      1,   x ≠ -1.

Hence the domain of f is {x | x ≠ ±1}.

The second function, g has a square-root.  The inside of a the square-root must be non-negative, so

(x^2) - 1 = (x + 1) (x - 1) ≥ 
        0, 
x ≤ -1,   x ≥ 
      1.

Hence the domain of g is \(TraditionalForm\`{x | x ≤ \(-1\), 
          x ≥ 
            1} = \((\(-∞\), \(-1\)]\) ⋃ \([1, ∞)\)\).

The third function, h has a natural log.  The inside of a the log function must be positive, so

(x^2) - 1 = (x + 1) (x - 1) > 
        0, 
x < -1,   x > 1.

Hence the domain of h is \(TraditionalForm\`{x | x < \(-1\), 
          x > 1} = \((\(-∞\), \(-1\))\) ⋃ \((1, ∞)\)\).

Addendum.

Here are the Mathematica commands to plot the graphs of above functions.  Can you explain the error messages?

Plot[(1/((x^2) - 1)), {x, -3, 3}, PlotStyle -> {Blue}, 
        AspectRatio -> 1/GoldenRatio];
Plot[(Sqrt[(x^2) - 1]), {x, -3, 3}, 
        PlotStyle -> {Blue}];
Plot[Log[(x^2) - 1], {x, -3, 3}, 
        PlotStyle -> {Blue}];

3.2.3.  Range and image.

Given function f : D -> Y, the set of points in the target Y to which a function value is assigned is called the range of the f.  We denote the range of f as f(D), where D is the domain of f.  In general, for a set A ⊂ D, we define the image of A under the function f as the following.

f(A) = {y | y = f(x), 
        x ∈ A}

Clearly, the range is the image of the entire domain.  How to find the range (or the image) of a function (and a given set) will be an important topic for calculus.

(3.3)  One-to-one functions and inverse functions.

Recall that a function assigns each element of the domain to one and only one element of the target.  Thus, no element in the domain is assigned to more than one element of the target.  But there is no such restriction in the target.  That is, in general, more than one elements in the domain can share the same image in the target.  A one-to-one function is a special type of functions that each element of its domain is assigned to a distinct element of the target.  We can paraphrase this as the following mathematical statement.

Definition 3.3.1.

Let f : D -> Y be a function.  f is called one-to-one, if

f(x) ≠ 
      f(y),   if  x ≠ y

for any x, y ∈ D.

Example 3.3.2.

Here is an example of a one-to-one function.

\(TraditionalForm\`\(\(\ \)\(f : ℝ -> ℝ, \ \ f(x) = x - 1\)\)\).

Why is this function one-to-one?  Note that

y = x - 1,  so  x = y + 1.

In other words, every element y in the range came from one and only one element of the domain.  Namely, y + 1.

This function is not one-to-one.

\(TraditionalForm\`\(\(\ \)\(g : ℝ -> ℝ, \ \ g(x) = x\^2 - 1\)\)\).

In this case, we can find a counter-example.

g(1) = g(-1) = 0

Obviously, 1 ≠ -1.  Therefore, g is not one to one.  If we restrict the domain so that \(TraditionalForm\`g : \([0, ∞)\) -> ℝ\), then g is one to one in the new domain [0, ∞).

If a function is one-to-one, that is, if every element in the range corresponds to one and only one element in the domain, we can consider the backward assignment, which call the inverse function.  The following definition paraphrases this idea in precise mathematical terms.

Definition 3.3.3.

Let f : D -> Y be a one-to-one function, then its inverse function (f^(-1)) : f(D) -> D is defined as

y = (f^(-1))(
              x)  if and only if  x = f(y).

The inverse function can be defined only for one-to-one functions.  For this reason, we call a one-to-one function, an invertible function.

Example 3.3.4.

1.  Find the inverse of the following function.

f(x) = (Sqrt[x - 1]),   x ≥ 
      1.

2.  Find the inverse of the following function.  (c.f.  Example 1.3.6.)

\(TraditionalForm\`\(\(\ \)\(g(
        x) = \(2  x\  + \ 3\)\/\(3  x\  - \ 1\), \ \ x ≠ \(\(1\/3\)\(.\)\)\)\)\)

Solution 1.

y = (Sqrt[x - 1]),   (y^2) = x - 1,   x = 
      (y^2) + 1.

Hence, the inverse function is

(f^(-1))(x) = (x^2) + 1.

Solution 2.

Let us start with

\(TraditionalForm\`\(\(\ \)\(y = \(2  x\  + \ 3\)\/\(3  x\  - \ 1\)\)\)\).

Now, let us get rid of denominators and begin to solve x with respect to y.

y(3  x - 1) = 2  x + 3

        3  x y - y = 2  x + 3

     3  x y - 2  x = y + 3

      x(3  y - 2) = y + 3

Thus, we get the following expression.

\(TraditionalForm\`\(\(\ \)\(x = \(y\  + \ 3\)\/\(3  y\  - \ 2\)\)\)\)

Therefore, the inverse function is,

(f^(-1))(
          x)  = ((x  +  3)/(3  x  -  2)).

Example 3.3.5.

Which of the following three plots represent the graph of a one-to-one function?

Clear[x, y]
plot1 = 
        Plot[(x^3) - x, {x, -2, 2}, AspectRatio -> Automatic, 
          PlotStyle -> {Blue}, 
          DisplayFunction -> Identity];
plot2 = 
        Plot[(1/2) Tan[(π/6) t], {t, -3, 3}, 
          AspectRatio -> Automatic, PlotStyle -> {Red}, 
          PlotRange -> {-2, 2}, 
          DisplayFunction -> Identity];
plot3 = 
        Plot[x Sin[(x^2)], {x, -π, π}, 
          AspectRatio -> Automatic, PlotStyle -> {DarkGreen}, 
          DisplayFunction -> Identity];
Show[GraphicsArray[{plot1, plot2, plot3}], 
        DisplayFunction -> $DisplayFunction];

Solution.

No t-coordinate value must be assigned from more than one x-coordinate value.  Therefore, the answer is the second plot.  This idea is visualized in the following fashion.

Clear[x, y]
plot1 = 
        Plot[{(x^3) - x, 0.25}, {x, -2, 2}, AspectRatio -> Automatic, 
          PlotStyle -> {Blue, Black}, 
          DisplayFunction -> Identity];
plot2 = 
        Plot[{(1/2) Tan[(π/6) t], 1}, {t, -3, 3}, 
          AspectRatio -> Automatic, PlotStyle -> {Red, Black}, 
          PlotRange -> {-2, 2}, 
          DisplayFunction -> Identity];
plot3 = 
        Plot[{x Sin[(x^2)], -1}, {x, -π, π}, 
          AspectRatio -> Automatic, 
          PlotStyle -> {DarkGreen, Black}, 
          DisplayFunction -> Identity];
Show[GraphicsArray[{plot1, plot2, plot3}], 
        DisplayFunction -> $DisplayFunction];

Note that the horizontal line y = a crosses the first and the third plot multiple times, but it crosses the second plot just once, no matter what a value you take.  This method is called the horizontal line test.

Proposition 3.3.6.

The graph of the inverse function is symmetric to that of the original function with respect to the line y = x.  The proof is left to interested readers.

Example 3.3.7.

Plot the graphs of the following pairs of functions and discuss the symmetry with respect to y = x.

f(x)=(x^2)  and  g(x)=(Sqrt[x])

Plot[{(x^2), (Sqrt[x]), x}, {x, 0, 2}, 
        PlotStyle -> {{Blue, Thickness[0]}, {Red, 
              Thickness[0]}, {Purple, Thickness[0]}}, 
        AspectRatio -> Automatic, 
        PlotRange -> {0, 2}];

f(x)=(e^( x))  and  g(x)=Log[x]

expplot = 
        Plot[{(E^x), x}, {x, -3, 3}, 
          PlotStyle -> {{Blue, Thickness[0]}, {Purple, Thickness[0]}}, 
          AspectRatio -> Automatic, PlotRange -> {-3, 3}, 
          DisplayFunction -> Identity];
logplot = 
        Plot[{Log[x]}, {x, 0, 3}, PlotStyle -> {{Red, Thickness[0]}}, 
          AspectRatio -> Automatic, PlotRange -> {-3, 3}, 
          DisplayFunction -> Identity];
Show[expplot, logplot, 
        DisplayFunction -> $DisplayFunction];

(3.4)  Basic examples.

4.3.1.  Power functions.

f(x) = (x^( k))

Clear[f, k, x]
k = 2;
f[x_] = (x^k);
Plot[f[x], {x, -2, 2}, PlotStyle -> {Blue}];

You get a fraction if k < 0.  When k is a fraction, you get a radical.

\(TraditionalForm\`\(\(\ \)\(x\^\(-k\) = 
      1\/x\^\(\(\ \)\(k\)\), \ \ x\^\(\(\ \)\(m/n\)\) = \(\(\@\(x\^m\)\%n\)\(.\)\)\)\)\)

In the interval [0, ∞), all power functions are one-to-one.  In ℝ, only odd power functions are one-to-one.

f(x) = 
      (x^( k)),   (f^(-1))(
        x) = (x^(1/k)) = (x^(1/x)).

Clear[f, k, x]
k = 3;
f[x_] = (x^k);
g[x_] = (x^(1/k));
Plot[{f[x], g[x]}, {x, 0, 2}, PlotStyle -> {Blue, Red}, 
        PlotRange -> {0, 2}];

4.3.2.  The exponential function and the logarithmic function.

f(x)=(E^x),  g(x) = Log[x]

These functions are inverse of each other.  Their graphs are presented below.

Clear[f, g, x]
f[x_] = (E^x);
g[x_] = Log[x];
fplot = 
        Plot[f[x], {x, -5, 5}, PlotStyle -> {Blue}, 
          PlotRange -> {-5, 5}, 
          DisplayFunction -> Identity];
gplot = 
        Plot[g[x], {x, 0, 5}, PlotStyle -> {Red}, 
          PlotRange -> {-5, 5}, 
          DisplayFunction -> Identity];
Show[fplot, gplot, 
        DisplayFunction -> $DisplayFunction];

4.3.3.  Trigonometric functions and inverse trigonometric functions.

Here are the graphs of the three basic trigonometric functions.

f(x) = Sin[x],   g(x) = 
      Cos[x],   h(x) = Tan[x].

Clear[f, g, h, x]
f[x_] = Sin[x];
g[x_] = Cos[x];
h[x_] = Tan[x];
Plot[{f[x], g[x], h[x]}, {x, -π, 2  π}, 
        PlotStyle -> {Blue, Red, DarkGreen}, 
        PlotRange -> {-4, 4}];

In the interval [-π/2,  π/2], Sin[x] is one-to-one and it has the inverse function.

f(x) = 
      Sin[x],   f : [-(π/2), (π/2)] -> [-1, 
          1].

(f^(-1))(x) = 
      ArcSin[x],   (f^(-1)) : [-1, 
          1] -> [-(π/2), (π/2)].

Clear[f, g, x]
f[x_] = Sin[x];
g[x_] = ArcSin[x];
fplot = 
        Plot[f[x], {x, -(π/2), (π/2)}, 
          PlotStyle -> {Blue}, 
          DisplayFunction -> Identity];
gplot = 
        Plot[g[x], {x, -1, 1}, PlotStyle -> {Red}, 
          DisplayFunction -> Identity];
Show[fplot, gplot, 
        DisplayFunction -> $DisplayFunction];

In the interval [0,  π], Cos[x] is one-to-one and it has the inverse function.

g(x) = 
      Cos[x],   g : [0, (π/2)] -> [-1, 
          1].

(g^(-1))(x) = 
      ArcCos[x],   (g^(-1)) : [-1, 
          1] -> [0, (π/2)].

Clear[f, g, x]
f[x_] = Cos[x];
g[x_] = ArcCos[x];
fplot = 
        Plot[f[x], {x, 0, π}, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity];
gplot = 
        Plot[g[x], {x, -1, 1}, PlotStyle -> {Red}, 
          DisplayFunction -> Identity];
Show[fplot, gplot, 
        DisplayFunction -> $DisplayFunction];

In the interval (-π/2, π/2), Cos[x] is one-to-one and it has the inverse function.

\(TraditionalForm\`\(\(\ \)\(h(x) = 
      Tan[x], \ \ h : \((\(-\(π\/2\)\), π\/2)\) -> \(\((\(-∞\), ∞)\)\(.\)\)\)\)\)

\(TraditionalForm\`\(\(\ \)\(\(h\^\(-1\)\)(x) = 
      ArcTan[x], \ \ \(h\^\(-1\)\) : \((\(-∞\), ∞)\) -> \(\((\(-\(π\/2\)\), π\/2)\)\(.\)\)\)\)\)

Clear[f, g, x]
f[x_] = Tan[x];
g[x_] = ArcTan[x];
fplot = 
        Plot[f[x], {x, -(π/2), (π/2)}, 
          PlotStyle -> {Blue}, PlotRange -> {-5, 5}, 
          DisplayFunction -> Identity];
gplot = 
        Plot[g[x], {x, -5, 5}, PlotStyle -> {Red}, 
          DisplayFunction -> Identity];
Show[fplot, gplot, 
        DisplayFunction -> $DisplayFunction];

(3.5)  Algebra of functions.

3.5.1.  Addition, multiplication and division.

We can add multiply and divide functions to get new functions.

(f ± g)[x] = 
      f[x] ± g[x]

         (f g)[x] = f[x] g[x]

       (f/g)[x] = f[x]/g[x]

3.5.2.  Composition.

We can get a new function called a composite function by applying functions twice.

f ∘ g [x]  =  
      f[ g(x) ]

Example 3.5.3.

Let f, g, h be functions defined below.

f(x) = (Sqrt[x]),   g(x) = (x^2) - 1,   h(x) = 
      x + 1

Express the following functions in the simplest terms.

f + g,   (g/h),   f∘
      g,   g∘f,   f∘g∘
      h,   f∘h∘g.

Solution.

(f + g)[
          x] = f(x) + g(x) = (Sqrt[x]) + (x^2) - 1.

\(TraditionalForm\`\(g\/h\) \((x)\) = \(\(g(x)\)\/\(h(x)\) = \(\(x\^2\  - \ 1\)\/\(x\  + \ 1\) = \(\(\((x\  + \ 1)\) \((x\  - \ 1)\)\)\/\(x\  + \ 1\) = x - 1\)\)\)\).

f∘
          g[x] = f[g(x)] = f[(x^2) - 1] = (Sqrt[(x^2) - 1]).

g∘
          f[x] = g[
            f(x)] = g[(Sqrt[x])] = ((((Sqrt[x])))^2) - 1 = x - 1.

f∘g∘h[x] = f[g(x + 1)] = 
              f[(((x + 1))^2) - 1]
                     =f[
                (x^2) + 2  x + 1 - 1] = (Sqrt[(x^2) + 2  x]).

f∘h∘g[x] = f[h((x^2) - 1)] = 
              f[((x^2) - 1) + 1]
                     \(\(=\)\(\@x\^2 = \(\(|\)\(x\)\(|\)\(.\)\)\)\)

Example 3.5.4.

Let f and g be functions defined below.

f(x) = (Sqrt[x]),  g(x) = x + 1

Find the function h and k so that

f∘h = 
      g,   k∘g = f.

Solution.

f[h(x)] = (Sqrt[h(x)]) = 
        x + 1

           h(x) = (((x + 1))^2).

k[
        g(x)] = k[x + 1] = (Sqrt[x])

           k(x) = (Sqrt[x - 1]).

3.5.5.  The composition of inverse functions.

What if we compose the f and (f^(-1))?  By definition, we have y = f[x]  if and only if  x = (f^(-1))[
            x].  Therefore,

(f^(-1))[f(x)] = (f^(-1))[y] = 
        x

for every x in the domain of f.  Also, by definition of the inverse function,

f[(f^(-1))(x)] = f[y] = 
        x

for every x in the domain of (f^(-1)) (or the range of f).

4.  Graphs

(4.1)  What is a graph?

Here is the precise definition of graph.

Definition 4.1.1.

Given function f : D -> Y, we call a set

{(x, y) | y = f(x), 
      x ∈ D}

the graph of the function f.

If \(TraditionalForm\`f : 
          D ⊂ ℝ -> ℝ\) (that is, both the domain and the range of f are subsets of ℝ), then the graph of f is a subset of (ℝ^2).

The basic Mathematica command to graph of a function is Plot.  Its basic syntax is Plot[f[x],{x,a,b}], where f[x] is the function and {x,a,b} means the viewing interval (a, b).

Plot[Sin[x], {x, 0, 2  π}];

(4.2)  How to Plot with Mathematica.

Example 4.2.1.

Plot the graph of the following function in an appropriate interval.

f(x) = (x^3) - x + 1

Solutions.

Here are several basic Mathematica programs to graph the same function.

Plot[(x^3) - x + 1, {x, -2, 2}];

Plot[(x^3) - x + 1, {x, -2, 2}, 
        PlotStyle -> {{Blue, Thickness[0]}}];

Clear[f, x]
f[x_] = (x^3) - x + 1;
Plot[f[x], {x, -2, 2}, 
        PlotStyle -> {{Blue, Thickness[0]}}];

Clear[f, x, a, b]
f[x_] = (x^3) - x + 1;
a = -2;  b = 2;
Plot[f[x], {x, a, b}, 
        PlotStyle -> {{Blue, Thickness[0]}}];

The first command is the bare-bone basic command.  It plots y = (x^3) - x + 1 in the interval (-2, 2) in default setting.  The second command has PlotStyle option, which allows us to select the color and the thickness of the graph.  The third and the fourth programs do the same thing as the second, but they allow us to define the function and the interval outside the Plot command.  This method is useful when plotting several pictures with the same function and/or interval.  Most of the plotting programs in UMM Calculus employ either the third or the fourth method.  Do not forget the underscore (f[x_]=...) when defining a function.

Example 4.2.1.

Plot the graph of the following functions in the same viewing window.

f(x) = (x^3) - x + 1

     g(x) = (1/2) x

Solutions.

Here are a couple of programs that do the similar things.

Plot[{(x^3) - x + 1, (1/2) x + 1}, {x, -2, 2}];

Clear[f, g, x]
f[x_] = (x^3) - x + 1;
g[x_] = (1/2) x + 1;
Plot[{f[x], g[x]}, {x, -2, 2}, 
        PlotStyle -> {{Blue, Thickness[0]}, {Red, 
              Thickness[0]}}];

The first program is bare-bone minimum command.  By putting two plot styles for two functions, we can plot better graphs, as we see in the second picture.

(4.3)  Commonly used options of Plot command.

4.3.1.  Before plotting your graph.

Here are a number of commands that proceeds Plot.

(a)  The function must be defined with an underscore, _.  That is, f[x_]=...; instead of f[x]=...;.

Clear[f, x]
f[x] = ((x^2)/2) + Sin[(x^2)];
Plot[f[x], {x, -π, π}];

Clear[f, x]
f[x_] = ((x^2)/2) + Sin[(x^2)];
Plot[f[x], {x, -π, π}];

(b)  Putting a semicolon after an algebraic expression lets Mathematica do the computation without producing an output.  Try f[x_]=... instead of f[x_]=...;.

f[x_] = ((x^2)/2) + Sin[(x^2)]/Cos[(x^2)]

f[x_] = (x^2) + Sin[(x^2)]/Cos[(x^2)];

4.3.2.  Basic options of Plot command.

(a)  You can adjust the viewing window by adjusting the option {x,a,b}.

Plot[((x^2)/2) + Sin[(x^2)],{x, -π, π}];

Plot[
        ((x^2)/2) + 
          Sin[(x^2)], {x, -((3  π)/2), ((3  π)/2)}];

(b)  You can adjust the PlotStyle to change the color or the thickness of the graph.

Plot[((x^2)/2) + Sin[(x^2)], {x, -π, π}, 
        PlotStyle -> {Blue, Thickness[0]}];

Plot[((x^2)/2) + Sin[(x^2)], {x, -π, π}, 
        PlotStyle -> {Cyan, Thickness[0.05]}];

(c)  You can plot two or more graphs together by joining them in a brace.  When there are more than one functions, the same number of plot styles are needed.

Plot[{((x^2)/2) + Sin[(x^2)], ((x^2)/2)}, {x, -π, π}, 
        PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
              Thickness[0]}}];

Plot[{(((x^2) + 1)/3) 
            Sin[(x^2)], (((x^2) + 1)/3), -(((x^2) + 
                  1)/3)}, {x, -π, π}, 
        PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
              Thickness[0]}, {Red, Thickness[0]}}];

4.3.3.  Intermediate level options of Plot command.

(a)  You can adjust the AspectRatio to change the height/width of the outcome.  By setting AspectRatio->1/GoldenRatio, we can squeeze the graph into a golden rectangle.  AspectRatio->1 squeezes the graph into a square.  The default setting of UMM Calculus notebooks is  AspectRatio->Automatic, which disables the forced distortion.

Clear[f, g, x]
f[x_] = (x^3) - x + 1;
g[x_] = (1/2) x + 1;
Plot[{f[x], g[x]}, {x, -1.5, 1.5}, 
        PlotStyle -> {{Blue, Thickness[0]}, {Red, Thickness[0]}}, 
        AspectRatio -> 1/GoldenRatio];
Plot[{f[x], g[x]}, {x, -1.5, 1.5}, 
        PlotStyle -> {{Blue, Thickness[0]}, {Red, 
              Thickness[0]}}];

(b)  You can adjust the PlotRange to change literally the plot range.  Here are some examples.

Clear[f, g, 
      x]
f[x_] = 
        Tan[x];
Plot[{f[
            x]}, {x, -(π/2), (π/2)}, 
        PlotStyle -> {{Blue, 
              Thickness[0]}}];
Plot[{f[
            x]}, {x, -(π/2), (π/2)}, 
        PlotStyle -> {{Blue, Thickness[0]}}, 
        AspectRatio -> 1/GoldenRatio];
Plot[{f[x]},{x, -(π/2), (π/2)},PlotStyle -> {{Blue, Thickness[0]}},PlotRange -> {-3, 3}];

The first graph is too truthful.  The height/width ratio is nearly infinity (or width/height is nearly 0), so we see nothing.  The second is unnaturally squeezed.  The third is just right.  We took advantage of the PlotRange option because the graph had vertical asymptote.

Example 4.3.4.

Plot the graph of the following pair of functions in the same viewing window.

f(x)=(x^2)  and  g(x)=(Sqrt[x])

Note that the functions are the inverse of each other.  Therefore, the graphs must be symmetric with respect to the line y = x.

Solution.

Let us consider no-so-good solution first.

Clear[f, g, x]
f[x_] = (x^2);
g[x_] = (Sqrt[x]);
h[x_] = x;
Plot[{f[x], g[x], h[x]}, {x, 0, 2}, 
        PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
              Thickness[0.01]}, {Purple, Thickness[0]}}];

We can adjust the plot range to get perfectly symmetric graph.  Since f and g are inverse of each other, the range of f has to be the same as the domain of g to be fair.  Since the latter is given as (0, 2), by the plot option {x,0,2}, let us adjust the latter through the option PlotRange->{0,2}.

Plot[{f[x], g[x], h[x]}, {x, 0, 2}, 
        PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
              Thickness[0.01]}, {Purple, Thickness[0]}}, 
        PlotRange -> {0, 2}];

(4.4)  How to name and show graphics outputs.

4.4.1.  The basic idea of naming.

You can name some values or algebraic expressions and use them later.

Clear[a, b, f, x]
a = -3;
b = 3;
f[x_] = 
        (x^2) + Sin[2  π x];
Plot[{f[x], (x^2)},{x, a, b},PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
                Thickness[0]}}];

Clear[a, b, x]
a = (x^3) - x;
b = (x^2) - 2  x + 1;
Simplify[
      a + (b^2)]
Expand[
      a + (b^2)]
Factor[a + (b^2)]

4.4.2.  Naming graphics outputs.

You can name graphics outputs, too.

Clear[f, x]
f[x_] = (E^x);
graph1 = 
        Plot[(E^x), {x, -3, 3}, 
          PlotStyle -> {{Blue, Thickness[0.01]}}];

Show command is used to literally show graph1, which we named before.

Show[graph1];

Why do we do this at all?  This technique is useful when we need to display two ore more graphs of different plotting domains.  See the next example.

Example 4.4.3.

Plot the graph of the following pair of functions in the same viewing window.

f(x)=(e^( x))  and  g(x)=Log[x]

Note that the functions are the inverse of each other.  Therefore, the graphs must be symmetric with respect to the line y = x.

Solution.

Let us go ahead with not-so-desirable solutions as in Example 4.3.4.

Clear[f, g, h, x]
f[x_] = (E^x);
g[x_] = Log[x];
h[x_] = x;
Plot[{f[x], g[x], h[x]}, {x, -3, 3}, 
        PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
              Thickness[0.01]}, {Purple, Thickness[0]}}];

This doesn't look good, not to speak of the error messages.  What if we adjust PlotRange?

Plot[{f[x], g[x], h[x]}, {x, -3, 3}, 
        PlotStyle -> {{Blue, Thickness[0.01]}, {Red, 
              Thickness[0.01]}, {Purple}}, AspectRatio -> Automatic, 
        PlotRange -> {-3, 3}];

Definitely better, we still cannot get away from the error messages.  That is because the natural log function is not well-defined for negative numbers, while the plot is being done in the interval -3 ≤ x ≤ 3, or {x,-3,3}.  Plotting two separate graphs will be helpful here.

expplot = 
        Plot[{f[x], h[x]}, {x, -3, 3}, 
          PlotStyle -> {{Blue, Thickness[0.01]}, {Purple, 
                Thickness[0]}}, AspectRatio -> Automatic, 
          PlotRange -> {-3, 3}, 
          DisplayFunction -> Identity];
logplot = 
        Plot[{g[x]}, {x, 0, 3}, PlotStyle -> {{Red, Thickness[0.01]}}, 
          PlotRange -> {-3, 3}, 
          DisplayFunction -> Identity];
Show[expplot, logplot, 
        DisplayFunction -> $DisplayFunction];

Final remark.  The option DisplayFunction->Identity is used to plot the graphs (do the necessary computations) without displaying them, and DisplayFunction->$DisplayFunction option is used to display the (final) outcome.

(4.5)  Piecewise-defined functions.

The first example explains an elementary method.

Example 4.5.1.

Plot the graph of the following function in an appropriate viewing window.

f(x)={({{({{2  Cos[x], if x < 0}})}, {({{(1/4) (x^2)   , if x > 0}})}})

Solution.

The syntax := ⋯ /; ⋯ is used to define a function piece by piece.

Clear[f, x];
f[x_] := 2  Cos[x] /; x ≤ 0;
f[x_] := (1/4) (x^2) /; 0 < x;
\(fplot = 
        Plot[f[x], {x, \(-2\) π, 
            3}, 
		PlotStyle -> {{Blue, Thickness[0]}}];\)

Another way to define a function piecewise is to use the Piecewise function:

Clear[f, x];
f[x_] = 
        Piecewise[{{2  Cos[x],  x ≤ 0}, {1/4 x^2,  x > 0}}]
fplot = 
          Plot[f[x], {x, -2 Pi,  3},  
            PlotStyle -> {{Blue,  Thickness[0]}}];

The second example discusses another method.  You may need to review (4.4) first.

Example 4.5.2.

Plot the graph of the following function in an appropriate viewing window.

f(x)=(({{2  Cos[x], if x < 0}, {1        , if x = 0}, {(1/4) (x^2)   , if x > 0}})

Solution.

This time, let put together three graphics output.

Clear[f, x]
negplot = 
        Plot[2  Cos[x], {x, -2 π, 0}, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity];
posplot = 
        Plot[(1/4) (x^2), {x, 0, 3}, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity];
zeroplot = 
        Graphics[{Blue, PointSize[0.025], 
            Point[{0, 1}]}];
Show[negplot, posplot, zeroplot, 
        DisplayFunction -> $DisplayFunction];

Not only we got rid of the vertical line segment at x = 0, but also we plotted the point (0, 1), too.