Professional Documents
Culture Documents
CALCULUS
AND
LINEAR ALGEBRA I
Semester 1, 2015
Lecture Workbook
CONTENTS
Contents
0 MATLAB
0.1
Introduction to MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
0.2
Plotting Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
0.3
0.4
0.5
0.6
Plotting points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
0.7
Introduction to M-files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
0.8
Writing Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
0.9
Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
0.11 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18
1 Complex Numbers
20
1.1
Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
1.2
Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
1.3
Polar form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
1.4
Eulers formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
2 Vectors
26
2.1
Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26
2.2
Position Vectors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
2.3
Definition: Norm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
2.4
Vector Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
2.5
Scalar multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
2.6
Unit Vectors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
28
2.7
Vectors in 3 dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
2.8
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
2.9
Dot Product
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
36
2.11 Vectors in Rn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
38
39
CONTENTS
42
3.1
2 2 matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
3.2
42
3.3
43
3.4
Definition: Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
3.5
Equality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
3.6
Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
3.7
Scalar Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
3.8
Matrix Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
3.9
Transposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
4 Gaussian elimination
50
4.1
Simultaneous equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
4.2
Gaussian elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
50
4.3
60
4.4
Gauss-Jordan elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
5 Inverses
65
5.1
65
5.2
Definition: Inverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
66
5.3
71
6 Determinants
76
6.1
Definition: Determinant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
6.2
Properties of Determinants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
77
6.3
82
85
7.1
85
7.2
88
7.3
89
7.4
Geometrical Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
94
8.1
Ranking Webpages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
8.2
Geometry of eigenvectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
96
8.3
98
8.4
99
CONTENTS
9 Vector Spaces
104
9.1
9.2
9.3
9.4
9.5
9.6
Eigenspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
9.7
9.8
Bases
9.9
Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
10 Numbers
126
131
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
11.10One-to-one (1-1) functions - Stewart, 7ed. pp. 384-387; 6ed. pp. 385-388 . . . . . . . . . . 142
11.11Inverse Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
11.12Logarithms - Stewart, 7ed. p. 404; 6ed. p. 405
. . . . . . . . . . . . . . . . . . . . . . . . 146
CONTENTS
12 Limits
156
170
179
187
CONTENTS
217
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
234
248
. . . . . . . . . . . . . . . . . . . . . . . . . . 256
CONTENTS
18.6 Improper integrals - Stewart, 7ed. pp. 543-551; 6ed. pp. 544-551 . . . . . . . . . . . . . . 257
18.7 Techniques of integration - Stewart, 7ed. ch. 7; 6ed. ch. 8 . . . . . . . . . . . . . . . . . . 259
18.8 Integrals involving ln function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.9 Integration of rational functions by partial fractions . . . . . . . . . . . . . . . . . . . . . 264
18.10Volumes of revolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
19 Appendix - Practice Problems
273
287
21 Appendix - Basics
288
MATLAB
0.1
0.1.1
Introduction to MATLAB
Getting Started
Log in using your library username and password. Ask your tutor if you have a problem.
Open MATLAB just like any other Windows program.
StartPrograms MATLABMATLAB R2007a
Save all files to your student directory on H:/. Files saved onto individual computers or S:/ will
be deleted at the end of semester.
0.1.2
The MATLAB program window consists of the command window, command history, current directory
and a menu bar for opening and editing M-files.
The command window is the main window we will use. Simple calculations can be performed in the
command window. Executing functions, defining variables, viewing answers and information about errors
which may have occurred also all happen in the command window.
A history of the commands entered into the command window can be found in the command history.
Selecting a command from this window will re-execute the command in the command window.
The current directory contains a list of files that MATLAB can utilize. This is also the folder in which
MATLAB will save your work. The current directory should be set to your student account on H:/.
0.1.3
Getting Help
There are a number of resources available should you need assistance when using MATLAB. The most
easily accessible is MATLABs own built-in Help system.
Clicking the blue question mark button in the toolbar will open the Help window, as will typing
doc in the command window. You can search for the topic in question or navigate using the panel
on the left.
If you know the name of the function or operation you need help with, typing help <function
name> in the command window will display a short description of the function and how to use it.
Typing doc <function name> will open the Help window and navigate to the page dedicated to
that function or operation.
If you have trouble finding what you need with MATLABs Help system, there is a great deal of documentation and useful articles available online. The Mathworks website
http://www.mathworks.com/products/matlab/
has a lot of helpful descriptions and solutions which go beyond what is available in the MATLAB Help,
as well as m-files written and uploaded by users. A Google search often turns up results as well.
Practical sessions will rely heavily on the following resources:
http://www-mdp.eng.cam.ac.uk/web/CD/engapps/octave/octavetut.pdf
http://www.cs.ubc.ca/ nando/cpsc530a/handouts/cam matlab.pdf
Of course, your tutors and lecturers will be able to help you out during class or consultation times, and
the First Year Learning Centre is open from 24pm in 67641 every day.
0.1.4
Variables in MATLAB are names for mathematical objects (eg. numbers, vectors, matrices) which
are defined by the user, stored in MATLABs memory (for the current session), and can be used in
calculations. Variables can be defined (assigned values) by using = . For example, the commands
>> x = 3
x =
3
>> y = 1009.781
y =
1009.781
assign the value 3 to the variable x and the value 1009.781 to the variable y.
Variable names can be letters or words, and can contain numbers, so long as they begin with a letter
(eg. a1 is a valid variable name, but 1a is not). Variable names are case sensitive (eg. MATLAB treats
x and X as different variables).
Using the command clear followed by the name of a variable will remove that variable from MATLABs
memory. Using clear all will clear all variables at once. Note that it is not necessary to clear a variable
before redefining it. However, it is often a good idea to clear a variable after it is used to avoid mistakenly
using an incorrect value in future calculations.
MATLAB can be used in much the same way as a normal calculator for evaluating mathematical expressions and functions. Operations can be performed on numbers or variables (as long as the variables have
already been defined). Some operations, functions and constants are saved permanently in MATLAB.
We demonstrate a number of these here; a more thorough list can be found in the Appendix.
As with any computer language, commands in MATLAB must follow certain syntax rules. If you get an
error message after trying to execute a command, check that you have not made a mistake when typing
the command (eg. brackets, apostrophes, commas).
The MATLAB commands for basic mathematical operations are exactly what one would expect. Addition, subtraction, multiplication and division are all demonstrated below.
>> x = 10
x =
10
>> y = 5;
>> x+y
ans =
15
>> x-y
ans =
5
>> x*y
ans =
50
>> x/y
ans =
2
Note that after entering the command x = 10 MATLAB provided feedback, but after the command y =
5; no feedback was produced. Following a command with a semicolon will stop MATLAB from displaying
any output, though the command itself will still be executed.
Some other common operations (given below) include exponentiation, square root, log and sin. Note that
log is the natural logarithm (base e), not base 10.
>> x = 10
x =
10
>> y = 5
y =
5
>> x^y
ans =
100000
>> sqrt(x)
Tip 1: Entering a variable name as a command will return the value of that variable.
Tip 2: To remove a variable from MATLABs memory, use the command clear followed by the variable
name. To clear all variables at once, use clear all.
Tip 3: For help with any MATLAB command simply enter help followed by the command name (eg.
help acos).
Tip 4: By default MATLAB will display numbers to 4 decimal places. The command format long
changes this to 15 decimal places. To revert back to 4 decimal places, use format short.
Tip 5: Following any command with a semicolon will stop MATLAB from displaying any output (though
the operation will still be performed).
ans =
3.1623
>> log(x)
ans =
2.3026
>> sin(x)
ans =
-0.5440
>> exp(x)
ans =
2.2026e+004
The last answer above demonstrates MATLABs use of scientific notation: it is the number 2.2026 104 .
Do not confuse the e with Eulers number e = 2.718 . . .; to obtain this number, use the command
exp(1).
MATLAB has a number of other constants built-in, such as and i. For example, the commands
>> x = 3*pi
x =
9.4248
>> y = log(x)
y =
2.2433
>> clear all
assign the value 3 to the variable x, set y to be ln(x), and then clear MATLABs memory of all variable
values.
Check the Appendix for a more complete list of commonly used functions and constants.
Division of a non-zero number by 0 will return the result Inf or -Inf (representative of + and
respectively). Any other mathematically undefined operation will give the result NaN, which stands for
Not-a-Number. For example,
>> 0/0
ans =
NaN
In normal circumstances, Inf and NaN should be considered errors.
Tip 6: Pressing the up arrow in the command window will scroll up through previously executed
commands.
Tip 7: The result of the most recently executed command is stored as the variable ans.
Tip 8: The command who gives a list of all currently defined variables.
Tip 9: Some operations that might normally be considered undefined (eg. log(1) or arccos(2)) will
return complex answers in MATLAB. The reasons for this are not covered in MATH1051 (see courses on
complex analysis for details).
0.2
0.2.1
Plotting Functions
General ezplot Commands
MATLAB has a number of built-in commands to make plotting functions very easy. MATLAB plots
functions in a separate Figure window which will automatically open. To plot f (x) = sin(x) over
MATLABs default domain 2 < x < 2, use the command
>> ezplot(sin(x))
In general, to plot an arbitrary function f (x) type
>> ezplot(f(x))
Note that the symbols cannot be left out here.
MATLAB will endeavour to automatically assign a sensible range to the dependent variable if it is not
specified. The domain and range can, however, both be controlled by the user. The first command below
assigns the domain a x b, and the second assigns the same domain as well as range c f (x) d.
>> ezplot(f(x),[a,b])
>> ezplot(f(x),[a,b,c,d])
0.2.2
After a figure has been generated in MATLAB, it can be labelled and edited through the command
window (check MATLABs help file for instructions on how to do this) or through the menus in the figure
window itself. Axis labels, titles and legends can be added and modified through the Insert menu. To
edit the plots themselves, use View Property Editor.
0.3
0.3.1
One of MATLABs strengths is its support for vectors and matrices. Performing operations with such
objects is very easy in MATLAB, which has a wide range of built-in functions for manipulating them.
The following commands demonstrate how to define the matrices and vectors
4
2 4
a= 1 3 4 ,
b= 0 ,
and
A=
0 1
7
>> a = [1,3,4]
a =
1
3
4
>> b = [4;0;7]
b =
4
0
7
>> A = [2,4;0,7]
A =
2
4
0
7
Note that commas separate entries in a row and semicolons separate rows.
The following MATLAB segment details the commands which can be used to take the transpose of matrix
a; print the (1, 2) entry of matrix A; the inverse of A; and the product of A with itself.
>> a
ans =
1
3
4
>> A(1,2)
ans =
4
>> inv(A)
ans =
0.5000
0
>> A*A
ans =
4
36
0
49
-0.2857
0.1429
Tip 10: To plot multiple graphs on the same axes, use the command hold on before plotting the first
one, and then hold off when finished.
Tip 11: A set of grid lines can be toggled on and off using the command grid, or through the Property
Editor.
Tip 12: The name given to the independent variable in ezplot does not matter.
ezplot(sin(x)) and ezplot(sin(t)) will produce the same output.
For example,
Some functions which are normally applied to single numbers can be applied to all the elements of a
matrix at once. For example,
>> log(a)
ans =
0
1.0986
1.3863
Here, applying the log function to a vector gives the natural logarithm of each element of the vector.
Some functions require a full stop be inserted into the expression to operate in this way; for example,
you can square each element of a matrix as follows:
>> a.^2
ans =
1
16
In general, functions which have special definitions when applied to matrices (for example, multiplication
or exponentiation) will require the full stop, while functions which can only be applied to single numbers
(like logarithms) will not. Consult MATLABs documentation to determine whether a function can
operate on matrices, and whether it requires the full stop operator. See the Appendix for a more
thorough list of MATLAB operations which can be performed on matrices and vectors, as well as the
commands for some special matrices.
0.4
You have seen how to create and manipulate matrices in MATLAB. Systems of linear equations can be
written as matrix equations, so we can use MATLAB to easily solve such problems.
Consider the system of linear equations
2x +
x +
2 1
A = 1 1
0 2
y z =
1
y 2z = 1
2y z =
3
1
2 ,
1
1
b = 1
3
x
and x = y
z
b =
1
-1
3
will enter the values of A and b into MATLAB.
0.4.1
Solution by Inversion
Another method for solving systems of linear equations is Gaussian elimination. The function rref
performs Gaussian elimination to find the reduced row echelon form of a matrix. After finding the
reduced row echelon form of an augmented matrix (A|b), the solution to Ax = b can just be read off.
To augment two matrices in MATLAB (after first making sure that the dimensions match up correctly),
simply put them in square brackets separated by a space or comma. For example, to augment A and b
above and then solve Ax = b, use the commands
>> AugA = [A b]
AugA =
2
1
-1
1
1
-2
0
2
-1
>> rref(AugA)
ans =
1
0
0
0
1
0
0
0
1
1
-1
3
0.2000
2.4000
1.8000
Another way to solve a system using Gaussian elimination is to use MATLABs backslash operator.
To solve Ax = b use the command
>> x = A \ b
x =
0.2000
2.4000
1.8000
Tip 15: The command AugA = [A b] concatenates (joins) matrices A and b horizontally, while AugA
= [A; b] concatenates A and b vertically. In both cases, the lengths of the sides being joined together
must be the same.
0.5
MATLAB has a built in function called eig to calculate the eigenvalues of a matrix and give corresponding
eigenvectors. For example, to calculate the eigenvalues and eigenvectors of the matrix
1 3
A=
,
4 2
use the following commands.
>> A = [1 3; 4 2];
>> [V,D] = eig(A)
V =
-0.7071
-0.6000
0.7071
-0.8000
D =
-2
0
0
5
Here, the values on the diagonal of D are the eigenvalues of A, and the columns of V are the corresponding
eigenvectors. So A has an eigenvalue = 2 with associated eigenvector x = [0.7071, 0.7071]T and
another eigenvalue = 5 with associated eigenvector x = [0.6, 0.8]T .
0.6
Plotting points
You have seen how to use the ezplot command to plot functions of one variable. There are many
situations where you may instead wish to plot a set of discrete points on a cartesian plane. MATLABs
plot command can be used to do this.
To plot a set of points {(x1 , y1 ), (x2 , y2 ), . . . , (xn , yn )}, use the command plot(x,y), where x = [x1 , x2 , . . . , xn ]
and y = [y1 , y2 , . . . , yn ]. For example, to plot the points (0, 0), (1, 1), (2, 3), (4, 6), use the commands
>> x=[0,1,2,3];
>> y=[0,1,3,6];
>> plot(x,y)
Tip 16: Be careful when using the command [V,D] = eig(A). No matter what you call V and D, the
one which comes first will be the matrix of eigenvectors, and the other will be the matrix of eigenvalues.
Tip 17: You can use hold on to simultaneously plot continuous functions with ezplot and discrete
points with plot.
10
There is an optional third argument for plot which specifies the colour, type of point and type of line
which will be used to plot the points. For example,
>> plot(x,y,ro)
will plot the points as red circles with no line joining them, and
>> plot(x,y,mx-)
will plot the points as magenta crosses joined by a solid line. Use the command help plot for a full
explanation.
As with ezplot, the properties of a figure (eg. title, axis labels, colour) can be edited using the menus
in the figure window.
0.7
Introduction to M-files
M-files are text files which contain sequences of operations which MATLAB will execute when the files
are run. In comparison to most programming languages, m-files are very easy to write, and are usually
built around only a few core commands.
0.7.1
11
You should save m-files you wish to keep in your H:/ directory.
To open a saved m-file:
Use the drop-down menu at the top of the screen to navigate to the correct folder, and then
double-click the file in the Current Directory panel;
Click the Open file button in the menu bar; or
Select File Open.
0.7.2
All of the commands which we have thus far covered will work as part of an m-file. For example, create
a new m-file, write the commands
x = sqrt(5);
y = exp(x)
and save the file as example.m. In the main MATLAB window, use the drop-down menu to navigate to
the folder where the file is saved, and then enter the command
>> example
y =
9.3565
in the command window. This illustrates the basic idea of using m-files: you write a sequence of commands, save them all together into an m-file, and then execute them all in order by calling the name of
the m-file as a command. Of course, the above example is very simple, and would take less time to just
evaluate in the command window.
M-files are far more useful when they are intended to be used over and over again, because the commands
only need to be typed out once. For example, say we have a collection of numbers (which we can store as
a vector), and we wish to perform some statistical analysis by calculating the size of the set, the mean,
median, mode, range and standard deviation, and we also wish to sort the numbers into ascending order.
MATLAB has built-in commands for all these operations. If we only have a single data set then we
may as well just type all the commands into the command window; however, if we have many sets then
we would be typing the same commands over again for each set. We can save time by putting all the
commands into an m-file. Put the following into an m-file and save it as statanalysis.m.
% For a vector x of real numbers, outputs the size of the set x,
% the mean, median, mode, range and standard deviation of the data,
% and sorts the data into numerical order.
setsize = length(x)
meanvalue = mean(x)
medianvalue = median(x)
modevalue = mode(x)
range = max(x) - min(x)
standarddev = std(x)
sortedx = sort(x)
Now we can perform all the operations at once by entering the vector x and then running statanalysis.
For example,
>> x = [1,4,10,-2,19,0,6,3,4,7];
>> statanalysis
setsize =
10
meanvalue =
5.2000
medianvalue =
4
modevalue =
4
range =
21
standarddev =
5.9777
sortedx =
-2
0
12
10
19
If we now have another data set we wish to analyze, we only need to redefine x to be that set, and run
statanlysis again.
0.7.3
If Statements
While m-files can be used to save time by collecting together operations which would otherwise take
time to execute in the command window, there are a number of special commands which make m-files
considerably more powerful. The first one we will look at is the if statement. It has the basic form
if condition
commands
end
where condition is a true/false statement and commands is a set of operations for MATLAB to perform.
These commands will be executed if condition is true; if they are false, MATLAB will do nothing. For
example, a valid if statement might be
if x>=0
y=sqrt(x)
end
Here, if x is greater than or equal to 0, then y will be the square root of x. If x is negative then MATLAB
does nothing. If we wanted MATLAB to do something when x is negative, we could add a second if
statement. However, an else command can be inserted into the if statement to accommodate this:
if condition
1st commands
else
2nd commands
end
For example, lets write a program to calculate the absolute value of a number. Create a new m-file and
insert the following code.
if x < 0
y=-x
else
y=x
end
Save the file as absval.m. Set the current directory to the folder containing the file, and enter the
commands
13
>> x = -5;
>> absval
y =
5
If your conditions have more than two possibilities (eg. a piecewise function which evaluates differently
over different intervals), then you can also make use of elseif statements.
if 1st condition
1st commands
elseif 2nd condition
2nd commands
else
3rd commands
end
You can use as many elseif statements as you like. As soon as a condition which is satisfied is found,
the corresponding command will be executed, and no further conditions will be checked. For example,
consider the following m-file (save it as checksign.m)
if x < 0
negative
elseif x > 0
positive
else
zero
end
This will check whether x is negative, positive or zero, and will output a string (the phrase inside the
) saying as much. For example,
>> x = -10;
>> checksign
ans =
negative
The condition in an if statement must be a boolean (true/false) expression. MATLAB has a number of
these, the simplest of which are detailed in the table below.
==
v=
<
<=
>
>=
equal to
not equal to
less than
less than or equal to
greater than
greater than or equal to
Tip 18: In MATLAB a word or phrase inside inverted commas ( ) is known as a string. Strings
can be used to display messages or label figures and axes, among other things. Variables can take string
values, though of course they cannot then be used in mathematical operations.
0.7.4
14
Good Habits
It is often the case that MATLAB code makes perfect sense to the author at the time of writing, but
is incomprehensible to anyone else or even the author themselves later on. Here are a few guidelines to
ensure that your code can be understood by anyone reading it.
Use intuitive and descriptive names for m-files, functions (see the next section) and variables.
Indent the commands inside specific statements (see the if statements above) and loops (discussed
in a later section).
Add thorough comments to your code. Anything written after a % character on a line is a comment
and will be ignored by MATLAB. Describe what an m-file does, the meaning of all its variables,
and what is achieved by any statements or loops.
0.8
Writing Functions
The example described in the previous section (absval.m) is fine for calculating the absolute value of a
number, but every time we want to change numbers we have to redefine x, which may be undesirable.
We can avoid this by converting the program into a function, so that we can input any value we like
without having to change any variables. Open absval.m and change the first line so that the file reads
as follows, and save it.
function y = absval(x)
if x< 0
y=-x;
else
y=x;
end
The first line of a function is very important. It gives the name of the function (here, absval; this must
match the name of the m-file itself), the name of any input variables (here, x) and the name of the
output variable (here, y). This function can now be executed like any other MATLAB function (eg.
sin or log). To calculate the absolute value of 8, use the command
>> absval(-8)
ans =
8
The value 8 will be assigned to the input variable x within the function, and the value of the output
variable y will be returned by the function.
Lets look at another example. Say we want to write a function which takes two n n matrices A and
B as input, and calculates (A + 2B)2 . The m-file would look as follows.
function y = matrixsumsquare(A,B)
y = (A+2*B)^2;
To evaluate the function on matrices A =
1 3
4 0
and B =
2 5
, use the commands
1 1
Tip 19: When saving a m-file function, make sure you the m-file has exactly the same name as the name
of the function (ie. the name given in the first line of the m-file).
0.9 Loops
15
>> A = [1 3; 4 0];
>> B = [2 5; 1 1];
>> matrixsumsquare(A,B)
ans =
103
91
42
82
Note that as with any variables, A and B must be defined before matrixsumsquare can operate on them.
The only variables MATLAB can access while evaluating a function are those given as input to the
function, or those which are defined within the function. For example, consider the function
function output = example(y)
output = x + y;
If you now try to evaluate this function by running the commands
>> x = 5;
>> example(10)
You will get an error, because the variable x is neither given as input for the function example, nor
defined within example.m.
The reverse is also true variables which are solely defined within functions will not be accessible outside
of the function, with the exception of the output variable (which will be output as ans).
Note that these caveats only apply to functions; m-files which are not functions can access any variables
defined in the command window, and vice versa.
0.9
0.9.1
Loops
While Loops
In a previous section you were introduced to the if statement, where MATLAB executes a command
only when a condition holds. A while loop has the same structure as an if statement:
while condition
commands
end
The difference is that while condition holds, commands is executed, and then the loop is restarted and
condition is checked again. The first time that condition does not hold MATLAB exits the loop and
moves on to the next line after end.
Consider the following example, which uses a while loop to calculate the factorial of a natural number
n, written n!. Recall that n! = n(n 1)(n 2) 2 1. MATLAB already has a built-in factorial function
(called factorial), but we will write our own. Note that we should not call the function factorial,
since a function with that name is already defined. We instead use the name fact.
function output = fact(x)
% temp is a temporary working variable
temp=1;
while x>1
temp=temp*x;
x=x-1;
end
output=temp;
0.9 Loops
16
Here, temp acts as a partial product: it starts out at 1, we multiply it by x, and then call that value
temp. We then decrease the value of x by 1, and then multiply temp by x again. This is repeated until
x takes the value 1, and we no longer need to multiply. The functions output is then the final value of
temp.
To use our function, we simply call it with a positive integer as the argument:
>> fact(6)
ans =
720
Note that as long as condition holds and commands does not alter any of the values used in condition ,
then the loop will continue running forever and MATLAB will crash. When you write a while loop,
ensure that there will definitely be some point at which condition is false. If you do happen to execute
code containing an infinite loop, use the command Ctrl+c to stop it.
0.9.2
For Loops
So far you have seen if statements and while loops, which execute commands when certain conditions
hold. Sometimes, however, we simply want the commands to be executed a fixed number of times without
depending on any conditions. This situation is handled by a for loop, which has the following form:
for variable = vector of values
commands
end
For each of the values in the vector, variable is assigned that value and the commands are executed.
This is best illustrated with an example. Consider the for loop
for j = [1,2,3,4,5]
t(j) = j^2;
end
Note that as this code is executed, we evaluate t(1), t(2), t(3), t(4), t(5), so the output t is a 1 5 vector.
In the first iteration of the loop, j takes the value 1, and then t(1) (that is, the first entry of the vector t)
takes the value 12 . In the next iteration, j takes the value 2, and t(2) takes the value 22 . This continues
on until j=5, after which the loop is exited.
We can use a for loop to write a factorial function, instead of a while loop as seen in the previous
section. Consider the following function:
function output = fact2(x)
% temp is a temporary working variable
temp=1;
for j=2:x
temp=temp*j;
end
output=temp;
Tip 20: The command Ctrl+c will stop MATLABs current operation.
Tip 21: There is an easier way to create the row vector [1, 2, 3, 4, 5], namely the command 1:5. In
general, the command x:n:y will create the vector [x, x + n, x + 2n, x + 3n, . . . , y]; that is, the numbers
from x to y in increments of n. If the n part is left out (eg. with the command 1:5), then MATLAB
assumes n = 1.
17
Here, we defined the vector of values which j takes as 2:x. This is the vector [2, 3, . . . , x]; so the loop
will be evaluated for j = 2, j = 3, . . . , j = x. Again, temp is acting as a partial product. In the first
iteration of the for loop, j takes the value 2, and temp is redefined as temp*2. In the next iteration, j
takes the value 3, and temp is redefined as temp*3. This is repeated until temp has been multiplied by
all the integers 2, 3, . . . , x, and it is this final value of temp which becomes the output.
Note that if either fact or fact2 had been evaluated with a negative number as input, they would both
return the value 1. This is because in both cases no iterations of the loop would be executed: in fact,
the statement x > 1 would be false from the beginning, so the while loop is never entered; and in fact2,
the vector 2:x would be empty, so the for loop is never entered. Hence the value of temp is never altered
from its initial value of 1.
0.10
In this section we mention a few MATLAB commands which may be useful when completing assignments
and/or other tasks in MATH1051.
0.10.1
The trapz function uses the trapezoid method to evaluate the integral of a function. Recall that the
trapezoid method involves dividing up the region under a function into vertical strips, finding the values
of the function where the strips meet, and using those values to calculate the area of the region.
The trapz function takes as its argument a vector, which it interprets as the set of values of a function
at the points where the vertical strips meet. By default, MATLAB assumes the strips are one unit wide.
For example, to find the area under the function f (x) = ln(x) between x = 1 and x = 100, use the
commands
>> x=1:100;
>> y=log(x);
>> trapz(y)
ans =
361.4368
To use trapz when the width of the strips is not 1, simply multiply the final answer by the width of
the strips. For example, to compute the same integral as above but with a strip width of 0.1, use the
commands
>> x=1:0.1:100;
>> y=log(x);
>> 0.1*trapz(y)
ans =
361.5162
0.10.2
The MATLAB functions fminsearch and fminbnd are used to find the minimum value of a function in
some region. fminsearch takes as input the function itself and a starting point x0. For example, to find
where the minimum value of f (x) = sin(x) near the value x0 = 0 occurs, use the command
>> fminsearch(sin(x),0)
ans =
-1.5708
0.11 Appendix
18
The answer -1.5708 is of course approximately /2, which is where a minimum of sin(x) occurs. To find
the value of the function itself at the minimum, you can evaluate the function with a separate command
(eg. sin(-1.5708)), or use the command
>> [xvalue,fvalue]=fminsearch(sin(x),0)
xvalue =
-1.5708
fvalue =
-1.0000
The function fminbnd performs a similar task to fminsearch, except instead of starting at an initial guess
x0, we provide an interval [a,b] inside which MATLAB will search for a minimum value. For example,
to find where the minimum value of f (x) = x3 + 10x2 in the interval [4, 4] occurs, use the command
>> fminbnd(x^3+10*x^2,-4,4)
ans =
-1.2543e-005
The answer 1.2543 105 is very close to 0, and it easily be verified analytically that the minimum
value of this function on the interval [4, 4] does occur at 0 (where the function takes the value 0). As
with fminsearch, to find the value of the function at this minimum, we can use the command
>> [xvalue,fvalue]=fminbnd(x^3+10*x^2,-4,4)
xvalue =
-1.2543e-005
fvalue =
1.5732e-009
0.11
0.11.1
Appendix
Common Numerical Operations & Constants
The following table lists the MATLAB commands for a number of commonly used functions which operate
on numbers, as well as some constants. Use MATLABs help command for more information.
Operation
x+y
xy
xy
x/y
xn
x
ln(x)
log10 (x)
x 10n
0.11.2
MATLAB
Code
x+y
x-y
x*y
x/y
x^n
sqrt(x)
log(x)
log10(x)
xen
Operation
ex
|x|
sin(x)
cos(x)
tan(x)
arcsin(x)
arccos(x)
arctan(x)
n!
MATLAB
Code
exp(x)
abs(x)
sin(x)
cos(x)
tan(x)
asin(x)
acos(x)
atan(x)
factorial(n)
Constant
MATLAB
Code
pi
i
exp(1)
Inf
-Inf
The following table lists the MATLAB commands for a number of commonly used operations which can
be performed on vectors and/or matrices.
0.11 Appendix
19
Operation
3
4
Entering a row vector: a = 1
4
Entering a column vector: b = 0
7
2 4
Entering a matrix: A =
0 1
Second component of vector b:
Entry (1, 2) of a matrix A:
Transpose: c = aT
Adding vectors or matrices: b + c
Dot product: b c
Cross product: b c
Norm: kak
Multiplying matrices: AB
Matrix determinant: det(A)
Inverse: A1
Vector dimension:
Matrix dimensions:
Minimum value in vector b:
Maximum value in vector b:
0.11.3
MATLAB Code
a=[1,3,4]
b=[4;0;7]
A=[2,4;0,1]
b(2)
A(1,2)
c=a
b+c
dot(b,c)
cross(b,c)
norm(a)
A*B
det(A)
inv(A)
length(a)
size(A)
min(b)
max(b)
Special Matrices
MATLAB has a number of special matrices built-in, and these can be produced with certain commands,
given in the table below.
Matrix
n n identity matrix
m n matrix of ones
m n matrix of zeros
MATLAB Code
eye(n)
ones(m,n)
zeros(m,n)
20
Complex Numbers
1.1
Notation
Let R denote the set of real numbers. The symbol means is an element of. Thus we write
xR
1.2
Complex Numbers
Complex numbers were introduced in the 16th century to obtain roots of polynomial equations. A complex
number is of the form
z = x + iy
where x, y R and i is (formally) a symbol satisfying i2 = 1. The quantity x is called the real part of
z and y is called the imaginary part of z.
The set of all complex numbers is denoted C. Eg 3 2i C.
1.2.1
Example
Example
(3 2i)(1 + i) = 3 + 3i 2i 2i2
= 3+i+2=5+i
(3 2i)(1 + i)
1.2.3
Example
3 + 3i 2i 2i
3+i+2=5+i
21
(a + bi)(a bi)
2 2
a abi + abi b i
a +b
Example
Simplify
3 2i
.
1i
We multiply top and bottom by the complex conjugate of the denominator. This does not change the
value of the fraction, but the new denominator is a real number.
3 2i
1i
3 2i (1 + i)
1i
(1 + i)
(3 2i)(1 + i)
12 + 12
1
(3 2i)(1 + i)
2
1
(5 + i)
2
5 1
+ i
2 2
=
=
=
=
=
We multiply top and bottom by the complex conjugate of the denominator. This does not change the value of the fraction, but the new denominator is a
real number.
3 2i
1i
=
=
=
=
=
3 2i
1i
(1 + i)
(1 + i)
(3 2i)(1 + i)
12 + 1 2
1
2
1
2
5
2
(3 2i)(1 + i)
(5 + i)
+
1
2
It is a fact that if we consider complex roots of polynomials (and count them with their correct multiplicity), then a polynomial of degree n always has n roots. For example, every quadratic has two
roots.
1.2.5
22
Example
1
1
(2 4 8) = (2 2i)
2
2
= 1 i.
x =
Alternatively, complete the square. Take half the coefficient of the linear term 2x, namely 1. So consider
(x + 1)2 :
x2 + 2x + 2 = (x + 1)2 + 1 = 0
(x + 1)2 = 1 = i2
x + 1 = i
x = 1 i are the roots.
Use the quadratic formula:
=
=
(2
2
1 i.
4 8) =
1
2
(2 2i)
Alternatively, complete the square. Take half the coefficient of the linear term 2x, namely 1. So consider (x + 1)2 :
x + 2x + 2
(x + 1) + 1 = 0
x + 1
(x + 1)
1.3
1 = i
Polar form
Real numbers are often represented on the real line. A complex number z = x + iy may be represented
by a point in the complex plane, where the horizontal axis is the real axis and the vertical axis is the
imaginary axis.
We can also specify z by giving the length r and the angle in figure 1. The quantity r is called the
modulus of z, denoted |z|. It measures the distance of z from the origin. The angle is called the
argument of z. We have:
23
Imaginary
z=x+iy
r
Real
x =
r cos
y =
r sin
z = x + iy =
Also
p
x2 + y 2
y
tan =
if x 6= 0.
x
r = |z| =
r cos
r sin
z = x + iy
r(cos + i sin ).
r = |z|
Also
tan
1.3.1
Example
r(cos + i sin ).
q
y
x
x2 + y 2
if x 6= 0.
24
1+1=
2.
y
We have for the argument tan = , so we can take
x
y
x
= arctan 1
=
4
z =
2 cos + i sin
.
4
4
= arctan
|z| =
We have for the argument tan =
y
x
1+1=
2.
, so we can take
=
=
=
1.4
arctan
x
arctan 1
2
cos
+ i sin
.
Eulers formula
Notes
25
2.1 Review
26
Vectors
A vector quantity has both a magnitude and a direction. Force and velocity are examples of vector
quantities.
A scalar quantity has only a magnitude (it has no direction). Time, area and temperature are
examples of scalar quantities.
2.1
Review
A vector is represented geometrically in the (x, y) plane (or in (x, y, z) space) by a directed line segment
(arrow). The direction of the arrow is the direction of the vector, and the length of the arrow is proportional to the magnitude of the vector. Only the length and direction of the arrow are significant: it can
be placed anywhere convenient in the (x, y) plane (or (x, y, z) space).
y
Figure 2: The vector of unit length at 45 to the x-axis has many representations.
(v 1 ,v 2)
y=v 2
Q=(xQ ,yQ )
v=<v 1 ,v 2>
PQ
yQ y P = v 2
xQ x P = v 1
x=v 1
(a)
P=(x P ,y P )
(b)
27
which is the same for all representations P Q of v. We call v1 , v2 the components of the vector v.
0
We call the vector
the zero vector. It is denoted by 0.
0
Vectors will be indicated by bold lowercase letters v, w etc. Writing by hand you may use v or ~v or ve.
2.2
Position Vectors
Let P = (xp , yp ) be a point in the (x, y) plane. The vector OP , where O is the origin, is called the
position vector of P . Obviously
xp
OP =
.
yp
2.3
Definition: Norm
For vector v =P Q,
norm (or length or magnitude ) of v, written kvk, is the distance between P and
the
v1
Q. Thus for v =
we have
v2
kvk =
q
v12 + v22
kvk =
2.4
2 + v2
v1
2
Vector Addition
v+w =
v 1 + w1
v 2 + w2
.
It follows from the component description that vector addition satisfies the following properties:
v+w =w+v
u + (v + w) = (u + v) + w
v+0 =0+v =v
(commutative law)
(associative law)
28
Figure 4: P Q + QR=P R
v
v2
v
v2
v1
v1
2.5
Scalar multiplication
2.6
Unit Vectors
29
1
v
kvk
1
kvk
1
0
,
j=
0
1
v1
v2
we have
v=
v1
0
+
0
v2
= v1 i + v2 j,
Hence we can decompose v into a vector v1 i along the x-axis and v2 j along the y-axis. The numbers v1
and v2 are called the components of v with respect to i and j.
2.7
Vectors in 3 dimensions
v1
xQ xP
v = v2 = yQ yP
v3
zQ zP
v1
30
z
P
v3
y
v1
kvk =
v2
q
p
ON 2 + N P 2 = v12 + v22 + v32 .
kvk =
ON 2 + N P 2 =
2 + v2 + v2 .
v1
3
2
v1
v = v2 ,
w=
v3
w1
w2
w3
v 1 + w1
v + w = v 2 + w2
v 3 + w3
v1 + w1
v + w = v2 + w2
v3 + w3
v1
and v = v2 , for R.
v3
and
v1
v = v2 , for R.
v3
0
1 ,
i=
,
j=
0
0
v1
Any vector v = v2 may be expressed as
v3
v = v1 i + v2 j + v3 k.
0
k = 0 .
1
31
x
x
2
3
y
R =
| x, y R
and R =
| x, y, z R .
y
2.8
a
b
, or as row vectors
a b . We usually use column
2.8.1
32
Example
An albatross is flying NE at 20 km/h into a 10 km/h wind in direction E60 S. Find the speed and
direction of the bird relative to the ground.
60 o
10
20
v
45 o
33
We have:
z = 20 cos 45 i + 20 sin 45 j
= 10 2i + 10 2j;
w = 10 cos 60 i 10 sin 60 j
= 5i 5 3j.
kvk =
(10 2 + 5)2 + (10 2 5 3)2
q
10 2 5 3
10 2 + 5
16
So v = 19.9kmh1 at E16 N.
We have:
20 cos 45 i + 20 sin 45 j
10 2i + 10 2j;
10 cos 60 i 10 sin 60 j
5i 5
3j.
kvk
19.91.
So v = 19.9kmh1 at E16 N.
tan
10 2 5 3
10 2 + 5
16
2.9
34
Dot Product
For non zero vectors v =OP , w =OQ the angle between v and w is the angle with 0 radians
v
w
vw =
0,
if v or w = 0
2.9.1
Example
1
v = 5 ,
4
3
w= 3
3
35
cos =
vw
.
kvk kwk
v w = 1 3 5 3 + 4 3 = 0.
vw
kvk kwk
v w = 1 3 5 3 + 4 3 = 0.
So cos = 0, so the vectors are perpendicular, i.e. =
2.9.2
Example
If P = (2, 4, 1), Q = (1, 1, 1), R = (2, 2, 3), find the angle = P QR.
QP
1
1
2
= 4 1 = 3 ,
2
1
1
2
1
3
QR = 2 1 = 1 .
3
1
2
QP
=
QR
1
+
9
+
4
=
14.
=
1
3
QP QR = 3 1 = 3 + 3 4 = 4
2
2
QP QR
4
cos =
= 14 ' 107 .
QP
QR
QP
QR
2
1
1
3 ,
4 1 =
1
1
2
2
1
3
1 .
2 1 =
1
2
3
QP
=
QR
= 1 + 9 + 4 = 14.
QP QR =
QP QR
4
cos =
=
' 107 .
14
QP
QR
1
3
3
1 = 3 + 3 4 = 4
2
2
2.10
36
w1 is in the direction of v
w2 is perpendicular to v.
v
w1
w2
w
x
Figure 9: w can be decomposed into a component w1 in the direction of v and a component w2 perpendicular to v.
Since w1 is in the direction of v, let
for some R.
w1 = v
Then w2 = w v.
We need to choose to make v and w2 orthogonal.
0 = w2 v = (w v) v = w v v v = w v kvk2 .
So we need
=
wv
.
kvk2
(w v)
v,
kvk2
w2 = w
(w v)
v.
kvk2
(2.1)
2.10.1
37
Example
6
2
onto v =
6
6
.
2.11 Vectors in Rn
2.11
38
Vectors in Rn
We are familiar with vectors in two and three dimensional space, R2 and R3 . These generalize to n
dimensional space, denoted Rn . A vector v in Rn is specified by n components:
v1
v2
vi R.
v= .
..
vn
We defineaddition
of vectors and multiplication by a scalar component-wise. Thus if R is a scalar
w1
w2
v1 + w1
v1
v2 + w2
v2
v+w =
v = . R,
= w + v,
..
.
.
.
v n + wn
vn
We define the dot (or scalar ) product between v and w as
v w = v 1 w1 + v 2 w2 + + v n wn
n
X
=
v k wk .
k=1
vw
=
=
v1 w1 + v2 w2 + + vn wn
n
X
vk wk .
k=1
vv
q
=
v12 + v22 + + vn2
kvk =
kvk
=
=
vv
q
2 + v2 + + v2
v1
n
2
39
where
0
..
.
0
ei =
1 ith position.
0
..
.
0
Proof:
v1
v1
0
v2
v = . = 0
..
..
.
vn
0
0
v2
0
..
.
0
0
..
.
0
0
vn
= v1 e1 + v2 e2 + + vn en .
An arbitrary vector v Rn can be written as
2.11.1
v1
0
0
.
.
.
0
v2
0
+
.
0
v1
v2
.
.
.
vn
v1 e1 + v2 e2 + + vn en .
+ +
0
0
.
.
.
0
vn
Notation
j = e2 ,
k = e3 .
0=
0
0
..
.
satisfying
0
0 + v = v + 0 = v,
0 v = 0,
2.12
(2) v (w + u) = v w + v u.
(3) (v) w = (v w) = v (w).
(4) v v 0 and v v = 0 if and only if v = 0.
40
Notes
41
42
3.1
2 2 matrices
a b
c d
x
is called a 2 2 matrix (plural matrices). Suppose v =
is a 2 element column vector. Then
y
the product Av is defined to be the 2 element column vector whose entries are given by taking the dot
product of each row of A with the vector v:
a b
x
ax + by
Av =
=
.
c d
y
cx + dy
3.1.1
Example
1 2
5
Let A =
, and let v =
. Calculate Av.
3 4
6
5
6
15+26
=
35+46
17
.
=
39
Av =
1 2
3 4
Av
1
3
15+26
35+46
17
39
3.2
2
4
5
6
.
a b
c d
0
1
=
b
d
and
.
3.2.1
43
Example
A maps i 7
2
1
2 1
1 2
and j 7
1
2
. Thus Ai =
2
1
and Aj =
1
2
.
.
In this way 2 2 matrices can be used to manipulate position vectors in the plane. This has application
in computer graphics. We often want to transform a set of points forming a figure on the screen. Eg
rescaling the figure, or rotating it about a central point etc. Such transformations can be accomplished
by multiplying by the appropriate matrix.
It can be shown that multiplying by a 2 2 matrix in this way always maps collinear points to collinear
points. For this reason a matrix is said to represent a linear transformation.
3.3
at + bv
ct + dv
x
y
.
3.6 Addition
3.4
44
Definition: Matrix
A=
a1n
a2n
..
.
am1 am2
amn
a11
a21
..
.
a12
a22
is called an m n matrix. It is made up of m rows and n columns. Entries of the jth column may be
assembled into a vector
a1j
a2j
..
.
amj
called the jth column vector of A. Similarly the ith row vector of A is
(ai1 ai2 ain ).
Note that an m 1 matrix is a column vector and a 1 n matrix is a row vector. The number aij in the
ith row and j column of A is called the (i, j)th entry of A. For brevity we write A = (aij ).
3.4.1
Example
A=
A=
3.4.2
0 1 2
1
0 1
0
1
1
0
2
1
.
.
Example
The m n matrix A whose entries are all zero is called the zero matrix, denoted 0; eg. the zero 3 2
matrix is
0 0
0 = 0 0 .
0 0
3.5
Equality
Matrices A, B are said to be equal, written A = B, if they are the same size and aij = bij , for all i, j.
3.6
Addition
The sum of two m n matrices A and B is defined to be the m n matrix A + B with entries
(A + B)ij = aij + bij
We add matrices element wise, as for vectors.
Addition is only defined between matrices of the same size.
3.6.1
45
Properties
3.7
Scalar Multiplication
for all i, j.
Write A for (1) A. Define subtraction between matrices of the same size by
A B = A + (B).
3.7.1
Example
Find A + B and A B if
A=
A+B =
1 5 3
3 2 2
A+B =
3.7.2
3.8
1
3
,
B=
5
2
,
3
2
AB =
,
AB =
5 1 0
3
1 0
9
3
9 7 3
3 0 2
7
0
3
2
.
.
Example
If A =
4 6 3
0 1 2
6
0
2 1
then A + A =
12
0
4 2
= 2A.
Matrix Multiplication
a11
..
.
ai1
..
.
am1
a12
..
.
ai2
..
.
am2
A
(m n)
a1n
..
ain
..
.
amn
b11 b1k
b21 b2k
..
.
..
.
bn1 bnk
B
(n r)
b1r
b2r
..
.
..
.
bnr
= AB
(m r)
where (ab)ik = dot product between ith row of A and kth column of B.
AB is only defined if the number of columns of A = the number of rows of B.
3.8.1
46
Example
0 1
2
Let A = (1 0 1) and B = 1
13
2
5
32
Then AB is defined, but B A is not defined.
32 13
Calculate AB.
0 1
2
AB = (1 0 1) 1
2
5
= (1 0 + 0 1 + 1 2
= (2
4)
AB
3.8.2
1 1 + 0 2 + 1 5)
0
1
2
1
2
5
(1 0 1)
(1 0 + 0 1 + 1 2
(2
1 1 + 0 2 + 1 5)
4)
Example
2
A = (1 3 9) , B = 1 .
7
2
(1 3 9) 1 = 2 + 3 + 63 = 68
13
7
31
2
6
18
1 3 9
= 1 3 9 .
13
7 21 63
2
1
7
31
2
(1 3 9) 1
13
7
2 + 3 + 63 = 68
31
2
1
7
31
3
13
2
1
7
6
3
21
18
9 .
63
3.9 Transposition
3.8.3
47
Properties
Associativity
A(B + C) = AB + AC
Distributive Laws
Another unusual property of matrices is that AB = 0 does not imply A = 0 or B = 0. It is possible for
the product of two non-zero matrices to be zero:
1 1
1
1
0 0
=
2 2
1 1
0 0
Also, if AC = BC, or CA = CB then it is not true in general that A = B. (If AC = BC, then
AC BC = 0 and (A B)C = 0, but this does not imply A B = 0 or C = 0.)
3.9
Transposition
a1n
a2n
..
.
am1 am2
amn
a11
a21
..
.
a12
a22
for all i, j
am1
am2
..
.
a1n a2n
amn
a11
a12
..
.
a21
a22
Examples of transpose
If A =
5 8 1
4
0 0
1 1
, C = (7 5 2) then find AT , B T , C T .
,B=
2
0
5 4
5 8 1
AT =
= 8 0
4
0 0
1 0
T
1 1
1 2
T
B =
=
2
0
1 0
7
.
C T =(7 5 2)TT = 5 54
5
8
1
T
0
A =
= 8
4
0
0
2
1
0
B
T
=
1
2
1
0
T
1
1
7
5 .
2
= (7 5 2)
2
0
3.9 Transposition
3.9.2
48
Properties
(2) (A + B)T = AT + B T
(3) (AT )T = A
(4) (AB)T = B T AT
(not AT B T !).
3.9.3
v1
v2
A column vector
v = . Rn
.
.
vn
may be interpreted as an n 1 matrix. Then the dot product (for two column vectors v and w) may be
expressed using matrix multiplication:
w1
w2
v w = v1 w1 + v2 w2 + + vn wn = (v1 v2 vn ) .
..
1n
wn
n1
= v T w.
Also
v v = v12 + v22 + + vn2 = kvk2
= v T v.
3.9 Transposition
Notes
49
4
4.1
50
Gaussian elimination
Simultaneous equations
One of the main applications of matrices is solving simultaneous equations of the form
a11 x1 + a12 x2 + + a1n xn
a21 x1 + a22 x2 + + a2n xn
..
.
= b1
= b2
..
.
where x =
x1
x2
..
.
(4.1)
xn
vector) and A = (aij ) is the m n matrix of coefficients.
b1
b2
..
.
bm
4.2
Gaussian elimination
We illustrate the process of Gaussian elimination. Given a set of equations, the idea is to perform
operations, called elementary row operations, in order to simplify the equations to the point where the
solution may be obtained easily.
Solve the following system of equations:
2x1 + 5x2 + 7x3 = 25
x1 + 2x2 + 2x3 = 9
2x1
+ 11x3 = 16
51
x1
2x1
2x1
+
+
2x2
5x2
+
+
+
2x3
7x3
11x3
=
=
=
9
25
16
x1
2x2
x2
+
+
+
2x3
3x3
11x3
=
=
=
9
7
16
2x1
Add 2 times first equation to third:
x1
2x2
x2
4x2
+
+
+
2x3
3x3
15x3
=
=
=
9
7
34
2x2
x2
+
+
2x3
3x3
3x3
=
=
=
9
7
6
x1
2x2
x2
+
+
2x3
3x3
x3
=
=
=
9
7
2
52
This process is called Gaussian elimination. We call this simplified set of equations
x1 + 2x2 + 2x3 = 9
x2 + 3x3 = 7
x3 = 2
the reduced form of the equations. Once in reduced form the set of equations is easily solved by back
substitution.
In this example we repeatedly performed the following operations:
(1) Interchange the order of two equations: swap the ith and j equations.
(2) Multiply an equation through by a non-zero number .
(3) Add times the jth equation to the ith equation.
Performing these operations does not change the solution of the equations. But eventually we obtained
such a simple system that we could easily find the solution.
4.2.1
The above procedure may be described most conveniently in terms of matrices. The information present
in a set of simultaneous equations
A x = b
mn n1
m1
25
9
16
2 5 7
1 2 2
2 0 11
2
1
2
5
2
0
7
2
11
25
9
16
Always keep in mind that each row of the augmented matrix represents an equation. The last column is
the RHS. The other columns are the coefficients of the variables. Eg the last row above corresponds to
2x1 + 0x2 + 11x3 = 16.
Another advantage of the augmented matrix notation is that if we want to solve two sets of equations
with the same coefficient matrix but different RHS:
Ax = b,
and Ay = c,
4.2.2
53
We rewrite the three allowable operations on equations discussed above, in terms of their effect on
the augmented matrix. Call the row vectors of the augmented matrix r 1 , r 2 , . . . etc. Since each row
corresponds to an equation, the operations are:
(1) Interchange rows i and j, written r i r j .
(2) Replace r i with r i , R, 6= 0, written r i
r i .
r i + r j .
These three operations are known as elementary row operations (EROs). In general we say that m n
matrices A, B are row equivalent, written A B, if and only if they are related by a series of EROs.
To solve a system of equations:
Set up the augmented matrix (A | b) representing the system.
Apply EROs to (A | b) to reduce it to a simpler matrix.
Eventually the system is so simple that the solution may be read off.
This is one of the most efficient procedures for solving linear equations.
4.2.3
Example
Redo the previous example 4.2, using row reductions. You should check that we are doing exactly the
same calculations as before, just with less writing.
54
25
9
16
2 5 7
1 2 2
2 0 11
Swap the first two rows: r 1 r 2 .
1 2 2
2 5 7
2 0 11
9
25
16
r 2 2r 1 .
1 2 2
0 1 3
2 0 11
9
7
16
r 3 + 2r 1 .
1 2 2
0 1 3
0 4 15
9
7
34
r 3 4r 2 .
1 2 2
0 1 3
0 0 3
9
7
6
1
3 r3 .
1 2 2
0 1 3
0 0 1
9
7
2
This is called a Gauss reduced form, or row-echelon form. The solution can now be read off directly by
back substitution as before.
r 3 gives x3 = 2.
Substitute x3 into r 2 : x2 + 6 = 7 so x2 = 1.
Substitute x2 , x3 into r 1 : x1 + 2 + 4 = 9 so x1 = 3.
2
1
2
5
2
0
25
9
16
2
5
0
2
7
11
9
25
16
1
0
2
2
1
0
2
3
11
9
7
16
r 2 2r 1 .
1
2
2
r 3 + 2r 1 .
1
0
0
2
1
4
2
3
15
9
7
34
r 3 4r 2 .
1
0
0
2
1
0
2
3
3
9
7
6
1
0
0
2
1
0
2
3
1
9
7
2
1r .
3 3
This is called a Gauss reduced form, or row-echelon form. The solution can now be read off directly by back substitution as before.
r 3 gives x3 = 2.
4.2.4
55
To solve
A
x = b ,
mn n1
m1
..
.
1
0
..
.
First column is now done.
Repeat on second column:
Find a row (not the first) with entry 6= 0 in column 2. (If none exists, go on to third column). Make
the leading entry 1, and clear out all the entries below this 1:
1
0
1
..
.
Then go on to the third column etc.
4.2.5
When solving a system Ax = b, we can stop doing EROs on (A | b) once A is simple enough to find
the solution by back substitution. This means we reduce (A | b) until:
All rows consisting entirely of 0s are at the bottom.
The first non-zero entry (leading entry or pivot) of each row is 1, and appears in a column to the
right of the leading entry of the row above it.
All entries in a column below a leading entry are zeros.
56
The reduced matrix is called the Gauss reduced form (or row echelon form) of A. For example:
1
0
0
0
1
0
0
0
0
1
0
The leading entries 1 (pivots) must be 1 and must have zeros below them. Not every column must have
a pivot. Above, the third column has no pivot.
The leading entries must form a stair case from top left to bottom right.
(Note that a matrix A may have more than one Gauss reduced form. Eg the entries marked above are
not unique. It doesnt matter which Gauss reduced form is used.) Tips:
Try to do row reductions that lead to the easiest algebra.
Try to avoid fractions.
Use row swaps to take advantage of existing 1s in the matrix.
We will look at the Gaussian Algorithm in a MATLAB session.
4.2.6
Rank of a Matrix
The number of pivots 1 in the row echelon form of a matrix A is called its rank, denoted rank A. The
matrix above has rank 3.
4.2.7
Example
Which of the following matrices are in Gauss reduced form (row echelon form)? For those in row echelon
form, determine the rank.
1 2 3 4
A = 0 0 1 4 ,
0 0 0 1
0 1 0 2
B = 0 0 1 2 ,
0 0 0 0
0 1 0 2
C= 1 0 0 0
0 0 1 0
A, B are row-reduced. C is not because the leading 1 in the second column is not to the right of the
leading 1 in the 1st column.
rank A = 3. rank B = 2. A, B are row-reduced. C is not because the leading 1 in the second column is not to the right of the leading 1 in
the 1st column.
rank A = 3. rank B = 2.
4.2.8
Inconsistent Equations
Not every system of linear equations has a solution. Consider the following example.
Solve
x1 + 2x2 x3 = 4
2x1 + 7x2 + x3 = 14
3x1 + 8x2 x3 = 17
57
1 2 1
2 7
1
3 8 1
4
4
1 2 1
3 6 (r 2
14 0 3
r 2 2r 1 )
17
0 2
2 5
(r 3
r 3 3r 1 )
1 2 1 4
1
0 1
1 2 (r 2
3 r2 )
0 2
2 5
1 2 1 4
1 2
0 1
0 0
0 1
r 3 2r 2 )
(r 3
1
2
3
2
7
8
1
1
1
4
14
17
1
0
0
2
3
2
1
3
2
4
6
5
1
0
0
2
1
2
1
1
2
4
2
5
2
1
0
1
1
0
4
2
1
1
0
0
(r 2
(r 3
r 2 2r 1 )
r 3 3r 1 )
(r 2
1r )
3 2
(r 3
r 3 2r 2 )
4.2.9
The Gauss reduced form of the augmented matrix will have one or more rows of the form (0 0 . . . 0 | a)
where a 6= 0. This leads to an impossible equation 0x1 + 0x2 + + 0xn = a 6= 0.
Geometrically, a linear equation in R2 represents a line. An equation in R3 represents a plane etc. Solving
two equations in R2 thus corresponds to finding the intersection of two lines in R2 . Usually two lines in
R2 have a unique point of intersection. But not always: parallel lines do not.
In fact parallel lines do not intersect at all, so there are no solutionsunless the lines are right on top of
each other, in which case they intersect in infinitely many points.
Solving three equations in R3 corresponds to finding the intersection of three planes. Usually three
planes have a unique point of intersection, but not always. Similarly for equations in more variables.
This underlies the next two examples.
58
4.2.10
59
1
1
2
3 2
1 2
4 2
1
1
r2 ) 0
4
0
(r 2
5
1
9 0
12
0
3
1
2
2
1
2
3
4
2
5
4
2
2
4
2
5
1
1 0
2
0
2
1
0
3
1
0
(r 2
(r 3
r2 + r1 )
r 3 2r 1 )
5
1 (r 3
0
r 3 +2r 2 )
x2 x3
= 1
No leading 1 in the third column (non-pivotal). So set x3 = arbitrary, and back substitute into r 2 and r 1 to give
x2
= 1 + x3 = 1 + ,
x1
5 3x2 + 2x3 = 8 3 + 2 = 8
1
1
2
(r 2
3 2
1 2
4 2
1
1
r2 ) 0
4
0
1
5
9 0
12
0
3
1
2
2
1
2
3
4
2
5
4
2
2
4
2
5
1
1 0
0
2
3
1
0
2
1
0
(r 2
(r 3
r2 + r1 )
r 3 2r 1 )
5
1 (r 3
0
r 3 +2r 2 )
= 1
No leading 1 in the third column (non-pivotal). So set x3 = arbitrary, and back substitute into r 2 and r 1 to give
x2
= 1 + x3 = 1 + ,
x1
5 3x2 + 2x3 = 8 3 + 2 = 8
60
x1
8
8
1
x = x2 = 1 + = 1 + 1 .
x3
0
1
8
The last equation is the equation of a line in R3 : x is given by a position vector p = 1 plus
0
1
times a vector v = 1 indicating direction.
1
Thus geometrically the three planes intersect along a common line rather than at a single point. Every
solution x corresponds to a point on this line obtained by a particular choice of . This means, for any choice
of R, a solution is:
8
8
1
x1
1 .
x = x2 = 1 + = 1 +
0
1
x3
8
1
1 plus times a vector v =
1 indicating direction.
0
1
Thus geometrically the three planes intersect along a common line rather than at a single point. Every solution x corresponds to a point on this line
The last equation is the equation of a line in R3 : x is given by a position vector p =
4.2.11
The system is consistent, and the Gauss reduced matrix will have one or more columns without a pivot
(leading entry). That is, the rank of A is less than the number of columns of A.
For example, if the second column does not have a leading 1 then there will never be an equation we can
use to isolate x2 , so x2 will be a free variable: we will be able to assign it any value ( say), and still
solve the system. In a big system we may have several free variables.
Any system with more than one solution will have a free variable. Since this variable can take any value,
the system will then have infinitely many solutions.
4.3
4.3.1
x = b
mn n1
m1
4.3.2
61
Let A be a matrix. The set of vectors x with Ax = 0 is called the nullspace of A, denoted NS(A).
The nullspace always contains the zero vector, since A0 = 0. We shall show later that the nullspace
either contains only the zero vector, or else contains infinitely many vectors.
The linear system Ax = 0 is called a homogeneous system. (Homogeneous means all the same.) Thus
the nullspace of A is the set of solutions of the homogeneous system.
A linear system Ax = b with b 6= 0 is called inhomogeneous.
4.3.3
Example
1 3 2
5
Let A = 1 1 2 and let b = 9 .
2 4 2
12
(a)
Calculate NS(A).
(b)
1
1
2
(r 2
to solve Ax = 0.
3 2 0
1 3 2 0
1 2 0 0 4 4 0
r2 + r1 )
(r 2
4 2 0
0 2 2 0
(r 3
r 3 2r 1 )
1 3 2 0
1 3 2 0
r2
r 3 +2r 2 )
) 0 1 1 0 0 1 1 0 (r 3
4
0 2 2 0
0 0 0 0
NS(A) = 1 | R .
1
For the nullspace we have to solve Ax = 0.
1
1
2
(r 2
3
1
4
1
) 0
4
0
r2
2
2
2
3
1
2
0
1
0 0
0
0
2
1
2
0
0
0
3
4
2
0
0
0
2
4
2
1
0
0
3
1
0
2
1
0
(r 2
(r 3
r2 + r1 )
r 3 2r 1 )
0
0
0
(r 3
r 3 +2r 2 )
1 |R .
NS(A) =
62
x1
8
8
1
x = x2 = 1 + = 1 + 1 = p + y,
x3
0
1
1
8
8
x1
1 = p + y,
x = x2 = 1 + = 1 +
1
0
x3
8
where p = 1 is a particular solution of Ax = b and y is any element in the nullspace NS(A).
0
4.3.4
Summary
4.4
Gauss-Jordan elimination
Gauss-Jordan (or simply Jordan) reduction involves performing more EROs on the Gauss reduced form
of a matrix until it has the additional property that each leading 1 is the only non-zero entry in its
column.
Solve
2x1 + 5x2 + 7x3 = 25
x1 + 2x2 + 2x3 = 9
2x1
+ 11x3 = 16
4.4.1
63
2 5 7 25
1 2 2
1 2 2
9 0 1 3
2 0 11 16
0 0 1
This is the Gauss reduced form. But we can
1 2 0
0 1 0
0 0 1
r1
r2
5
1 0
0 1
1
2
0 0
r 1 2r 3
r 2 3r 3
r1
9
7
2
operations.
0 3
0 1
1 2
r 1 2r 2
This is the Jordan reduced form. We can read off the solution directly: x1 = 3, x2 = 1, x3 = 2.
4.4.2
Gauss reduction leads to a matrix with 0s below the leading 1s, such as
1
0
0
0
1
0
0
0
0
1
0
while Gauss-Jordan reduction results in a matrix with 0s above and below the leading 1s such as
1
0
0
0
0
1
0
0
0
1
0
0
0
0
.
1
0
Jordan form has the advantage that the solution of the original system can be read off directly without
any back substitution. However Gaussian reduction is often preferred for solving systems.
Gauss-Jordan reduction is better if we want to solve many systems Ax = b, Ax = c etc with the same
coefficient matrix A, since it eliminates the need to do multiple back substitution steps. This is useful in
the next chapter.
Notes
64
65
Inverses
5.1
An n n matrix (m = n) is called a square matrix of order n. The diagonal containing the entries
a11 , a22 , , ann
is called the main diagonal (or principal diagonal ) of A. If the entries above this diagonal are all zero then
A is called lower triangular. If all the entries below the diagonal are zero, A is called upper triangular
a11 0
0
0
a11
a1n
..
..
. a22 0
0 a22
0
.
.
.
.
.
.
.
.
.
.
.
.
.
0
..
..
..
..
..
..
..
.
.
.
.
.
0
.
.
an1
ann
0
0 0 ann
lower triangular
upper triangular
If elements above and below the principal diagonal are zero, so
aij = 0 ,
i 6= j
Example
1
0 0
A = 0 3 0 is a diagonal 3 3 matrix.
0
0 2
5.1.2
The n n identity matrix I = In , is the diagonal matrix whose entries are all 1:
1 0 0 0
0 1 0 0
I = 0 0 1 0 .
..
.
.
. . ..
.
0 0 1
5.1.3
Recall from linear transformations of R2 : Ai is the first column of A and Aj is the second column.
For example, for the 2 2 case we have
a11 a12
1 0
a11 a12
AI =
=
= A = IA.
a21 a22
0 1
a21 a22
66
ej =
1 j.
0
..
.
0
Thus
0
.
..
0
j
1
0
..
.
0
Aej
a1j
a2j
..
.
a1n
a2n
..
.
an1
anj
ann
a11
a21
..
.
a1j
a2j
..
.
anj
jth column
= vector of
A.
So AI = A for all A.
Replacing A by AT , AT I = AT also. Transpose both sides: A = (AT )T = (AT I)T = I T (AT )T = IA, so
IA = A for all A.
We have proved that for all square matrices A
IA = AI = A.
5.2
Definition: Inverse
Let A be a 2 2 matrix A =
AB =
a b
c d
a b
c d
d b
. Set B =
. Then
c a
d b
c a
=
ad bc
0
0
ad bc
= BA.
67
Let
= ad bc.
If 6= 0, then
1
1
B=
A1 =
d b
c
a
We call the determinant of A. We will consider determinants in more detail later (chapter 6). The
problem of obtaining inverses of larger square matrices will also be considered later (section 5.2.5).
5.2.2
Example
. Check your answer.
1 2
3 5
= 1 5 2 3 = 1.
A
1
=
1
5 2
3
1
=
5
2
3 1
5
2
3 1
.
= 1 5 2 3 = 1.
A
1
1
2
1
5
3
=
5
3
2
1
.
1
3
5
3
2
5
2
1
5.2.3
Example
Show that A =
1 2
3 6
5
3
is not invertible.
2
1
2
5
1
3
5
3
1
0
0
1
1
0
0
1
=
=
2
1
.
68
Suppose A has inverse
a b
.
c d
1 2
a b
1 0
Then
=
3 6
c d
0 1
a + 2c = 1
b + 2d = 0
3a + 6c = 0
3b + 6d = 1
(1)
(2)
.
(3)
(4)
a
c
1
Then
3
b
1
=
d
0
2
a
6
c
b
d
a + 2c = 1
b + 2d = 0
3a
+ 6c = 0
3b + 6d = 1
0
(1)
(2)
.
(3)
(4)
Later we shall see that a square matrix is invertible exactly when its determinant is not 0.
5.2.4
2 3 1
16 17
7
5 . Show that B = A1 .
Let A = 1 2 3 and B = 11 12
2
2 5
2
2 1
2 3 1
16 17
7
1 0 0
5 = 0 1 0 .
AB = 1 2 3 11 12
2
2 5
2
2 1
0 0 1
And, similarly
16 17
7
2 3 1
1 0 0
5 1 2 3 = 0 1 0 .
BA = 11 12
2
2 1
2
2 5
0 0 1
Just multiply the two matrices together.
AB =
2
1
2
3
2
2
16
11
2
17
12
2
1
16
3 11
5
2
17
12
2
7
1
5 = 0
1
0
0
1
0
0
0 .
1
3
2
2
1
1
3 = 0
5
0
0
1
0
0
0 .
1
And, similarly
BA =
5.2.5
7
2
5
1
1
2
We can now give a systematic way of finding inverses of matrices, using GaussJordan reduction.
Sup-
69
Example
2 3
1
x1 y1 z1
Above A = 1 2 3 . We want a matrix X = x2 y2 z2 with AX = I.
2
2
5
x3 y3 z3
x1
y1
z1
1
0
0
Let x = x2 , y = y2 , z = z2 . We need Ax = 0 , Ay = 1 , Az = 0 .
x3
y3
z3
0
0
1
So Ax = i,
Ay = j,
Az = k. We can solve these 3 systems by augmenting A with all 3 RHS
vectors: (A | i j k). That is, we form (A | I). We use Gauss-Jordan reduction to solve the 3 systems at
once and find x, y, z.
2 3 1
Let A = 1 2 3 . Calculate A1 . (This is example 5.2.4).
2
2 5
70
2 3 1 1 0 0
1 2 3 0 1 0
1 2 3 0 1 0 2 3 1 1 0 0
2
2 5 0 0 1
2
2 5 0 0 1
r 1 r 2
1 0
7 2 3 0
5 1 2 0
0 1
0 0 1 2 2 1
r1
r 1 + 2r 2
r3
r 3 + 2r 2
16 17
7
1 0 0
11 12
5
0 1 0
0 0 1 2
2 1
r1
r 1 7r 3
r2
r 2 5r 3
1 2 3 0
1 0
0
1
5 1 2 0
0 2 11 0
2 1
r 2 2r 1
r2
r3
r 3 + 2r 1
2 3
0
1 0 7
0 1 5
1 2
0
0 0 1 2
2 1
r 3
r3
So A is invertible, and A1
16 17
7
5 .
= 11 12
2
2 1
1
0
0
1
0
0
So A is invertible, and A1 =
16
11
2
3
2
2
2
1
2
17
12
2
2
1
2
0
1
0
1
3
5
1
0
0
0
1
0
3
0
1
1
2
5
11
0
2
r2
r 2 2r 1
r3
r 3 + 2r 1
7
5
1
r3
2
3
1
2
2
2
r 3
0
0
1
0
0
1
0
0
1
2
3
0
3
1
1
0
2
5
r 1 r 2
1
2
2
1
0
0
1
0
0
1
0
0
0
7
2
3
1
2
1
5
0
1
2
2
r1
r 1 + 2r 2
r3
r 3 + 2r 2
0
1
0
0
0
1
r1
r2
16
17
11
12
2
2
r 1 7r 3
r 2 5r 3
0
0
1
0
0
1
7
5
1
7
5 .
1
In general, let xj be the jth column of the matrix X, and recall that ej is the jth column of I. Breaking
the previous matrix equation AX = I into one equation for each column gives rise to n equations
Ax1 = e1 , Ax2 = e2 , . . . , Axn = en .
(5.1)
We can regard each of these as a system to be solved. As we noted when introducing the augmented
matrix, we can solve more than one system of equations at once by forming a larger augmented matrix.
Eg
Ax = b, Ax = c 99K (A | b c)
Thus we may solve (5.1) by applying GaussJordan elimination to the augmented matrix
(A | e1 e2 , . . . , en ) = (A | I).
Reduce until we reach
(I | X).
The solution X can now be read off, so X = A1 is the inverse of A. If this reduction cannot be
completed, A has no inverse.
5.3
71
If A is n n, to find A1 :
Set up augmented n 2n matrix (A | I).
If this can be reduced to (I | X) then X = A1 .
If it cannot be reduced, then A is not invertible.
5.3.1
Above to find A1 we found X with AX = I. However for X to be the inverse of A, the definition of
the inverse matrix requires XA = I also. We shall show the surprising fact that if AX = I then XA = I
automatically, for square matrices.
We need a little theory. Let A be an n n matrix. We shall find several properties equivalent to A being
invertible.
Consider the following statements:
1. A is invertible.
2. NS(A) = {0}.
3. For every n 1 vector b the system Ax = b is solvable, with a unique solution x.
4. There exists an n n matrix B with AB = I.
We first show that (1) = (2) = (3) = (4):
Proof: (1) = (2) Suppose x NS(A). Thus Ax = 0. Multiply both sides by A1 to see that x = 0,
so NS(A) = {0}.
(2) = (3) If NS(A) = {0} then when we solve
variables. Row reducing must give
1
0
(A | 0) 0
..
.
1
0 1
.. ..
..
. .
.
0 0 0
0
0
0
,
.. ..
. .
1 0
1
0 1
(A | b) 0 0 1
.. .. ..
..
..
. . .
.
.
0 0 0
..
.
72
It is not surprising that (1) = (4): (4) is the statement AB = I, whereas (1) is the statement AB = I
and BA = I. Amazingly, once AB = I, we shall show that BA is forced to be I (for square matrices);
see below. This means (4) = (1) also.
FACT:
Consider the nullspace of D. Let x be any element in NS(D), so Dx = 0. Multiply both sides by C
on the left to get (CD)x = C(Dx) = C0 = 0. But CD = I (given), so Ix = 0 so x = 0. That is
NS(D) = {0}.
Thus property (2) holds for D. We have seen that (2) = (4), so (4) holds for D. That is, there exists
an n n matrix B with DB = I.
So C = CI = C(DB) = (CD)B = IB = B, that is, B = C. So DC = DB = I. Consider the nullspace of D. Let x
be any element in NS(D), so Dx = 0. Multiply both sides by C on the left to get (CD)x = C(Dx) = C0 = 0. But CD = I (given), so Ix = 0 so x = 0.
That is NS(D) = {0}.
Thus property (2) holds for D. We have seen that (2) = (4), so (4) holds for D. That is, there exists an n n matrix B with DB = I.
So C = CI = C(DB) = (CD)B = IB = B, that is, B = C. So DC = DB = I.
We have proved:
5.3.2
73
2. NS(A) = {0}.
3. For every n 1 vector b the system Ax = b is solvable, with a unique solution x.
4. There exists an n n matrix B with AB = I.
If any one of these statements holds, the other three also hold. If any one fails the other three also fail.
5.3.3
Consider the system Ax = b. In the special case that A is n n and invertible, we may solve this system
by multiplication on the left by A1 to give
1
1
1
A
| {z A} x = A b unique solution x = A b.
I
Properties of inverses
(not A1 B 1 !)
Proof
AC = CA = I.
74
and similarly
(B 1 A1 )(AB) = I.
Therefore AB is invertible with inverse
(AB)1 = B 1 A1 .
(3) and (4) are an exercise:
We prove (4). Assume that A is invertible. We have to show that the inverse of AT is (A1 )T . To show
that one matrix is the inverse of the other, we just multiply them together and check we get the identity.
We will need the fact that (AB)T = B T AT . Setting B = A1 in this, we have
(A1 )T AT = (AA1 )T = I T = I.
Similarly
AT (A1 )T = (A1 A)T = I T = I.
Therefore if A is invertible then AT is invertible with inverse
(AT )1 = (A1 )T
This also proves half of (3), namely A invertible implies A1 invertible. To prove the converse, just
replace A with AT in the above calculation. This concludes the proof of both (3) and (4). We prove (4).
Assume that A is invertible. We have to show that the inverse of AT is (A1 )T . To show that one matrix is the inverse of the other, we just multiply
them together and check we get the identity. We will need the fact that (AB)T = B T AT . Setting B = A1 in this, we have
(A
1 T
) A
= (AA
1 T
=I
= I.
=I
= I.
Similarly
T
1 T
A (A
Therefore if A is invertible then AT is invertible with inverse
= (A
T 1
(A )
A)
= (A
1 T
This also proves half of (3), namely A invertible implies A1 invertible. To prove the converse, just replace A with AT in the above calculation. This
concludes the proof of both (3) and (4).
Notes
75
76
Determinants
6.1
Definition: Determinant
Associated to each square matrix A is a number called the determinant of A and denoted |A| or det(A).
It is defined as follows.
If A is a 1 1 matrix, say A = (a) then |A| is defined to be a.
If A = (aij ) is 2 2 then we define
a
a
|A| = 11 12
a21 a22
= a11 a22 a12 a21 .
.... a1
.... a2
..
.
2
2
j1
j1
.... ai1
.... ai+1
..
.
.... an
j1
j1
j1
a1
a2
..
.
j+1
j+1
ai1
ai+1
..
.
an
j+1
j+1
j+1
.... a1n
.... a2n
..
.
.... ai1
.... ai+1
..
.
.... ann
n
n
called the cofactor of aij . The (n 1) (n 1) determinant is obtained by omitting the ith row
and jth column from A (indicated by the horizontal and vertical lines in the matrix).
We then define
|A| = a11 C11 + a12 C12 + + a1n C1n
which gives a recursive definition of the determinant.
Observe that
(1)i+j
+ +
+ +
+ +
a
a
= 22 23
a32 a33
C12
= a11 C11 + a12 C12 + a13 C13
a
a
= 21 23
a31 a33
C13
a
a
= 21 22
a31 a32
6.1.1
77
Example
3 5 7
1 0 2 .
0 3 0
1+3
C13 = (1)
2+3
C23 = (1)
M13
1 0
= 3,
=1
0 3
M23
3 5
= 9.
= 1
0 3
1+3
C13 = (1)
2+3
C23 = (1)
6.1.2
1
M13 = 1
0
0
= 3,
3
3
M23 = 1
0
5
= 9.
3
Example
3 5 7
Calculate the determinant 1 0 2
0 3 0
3 5 7
1 0 2
0 3 0
= (1) (3) 0 2
3 0
+ (1) (5) 1 2
0 0
+ (1) (7) 1 0
0 3
3
1
0
6.2
5
0
3
7
2
0
0
(1) (3)
3
1
2
+ (1) (5)
0
0
3.
1
2
+ (1) (7)
0
0
Properties of Determinants
Property (1):
|A| = AT
A =
a11 a21
a12 a22
0
3
78
Thus |A| = a11 a22 a12 a21 = AT . It can be shown that this holds for any square matrix, not just in
the 2 2 case.
This means that any results about the rows in a general determinant is also true about the columns (since
the rows of AT are the columns of A). In particular, any statement about the effect of row operations
on determinants is also true for column operations.
Warning: We used row operations to simplify systems of equations, because they do not change the
solution. Column operations may change the solution of linear systems, so we should not use column
operations on such systems.
Property (2): The determinant may be found by taking cofactors along any row (not just the first)
or down any column. Eg. for a 3 3 matrix A
|A| = a11 C11 + a12 C12 + a13 C13
= a21 C21 + a22 C22 + a23 C23
= a13 C13 + a23 C23 + a33 C33
Examples
3 5 7
(i) Calculate 1 0 2 by (a) expanding down the third column, (b) expanding along the third row.
0 3 0
Which is more efficient?
3 5 7
1 0 2
0 3 0
= 7 1 0 2 3 5 = 21 18 = 3
0 3
0 3
3 7
= 3(6 7) = 3
= 3
1 2
3
1
0
5
0
3
7
2
0
1
3
0
5
= 7
2
= 21 18 = 3
0
3
0
3
3
7
= 3
= 3(6 7) = 3
1
2
(ii) Find
3 6 9
0 0 0
2 4 5
exp. down
3rd. col.
exp. along
r3
exp. down
3rd. col.
exp. along
r3
79
3 6 9
0 0 0
2 4 5
= 0 C21 + 0 C22 + 0 C23
= 0
3
0
2
6
0
4
9
0
5
(expanding along r 2 )
(expanding along r 2 )
In general the determinant of any matrix with a row or column of zeros is equal to zero.
6.2.2
The calculation of large determinants from the definition is very tedious. It is much easier to calculate the
determinant after row reducing a matrix, because the reduced matrix will contain many zeros. However,
performing elementary row operations changes the value of a determinant. Luckily the changes are simple:
Property (3): A common factor in all entries of a row (or column) can be taken out as a multiplier
of the determinant.
6.2.3
Example
3 6 9
0 1 2
3 4 5
= 3C11 + 6C12 + 9C13
(expanding along r 1 )
(check!)
Example
3 5 7
We have seen 1 0 2
0 3 0
= 3. Interchanging columns 2 and 3 gives
3 7 5
1 2 0
0 0 3
3 7
= 3
1 2 (expanding along r 3 )
= 3.
Let A be a matrix, and let B be the matrix obtained by interchanging two rows or columns. Then
det(A) = det(B). If A has two equal rows (or columns) and these are interchanged then A = B so
det(A) = det(B) = det(A) so det(A) = 0. Hence:
80
r i +r j or ci
ci +cj ),
The above 5 properties give a shortcut for evaluating determinants. We can use a sequence of elementary
row operations (and/or column operations) to produce a matrix with a row (or column) with at most
one non-zero entry. We then expand along this row (or column) to obtain a smaller determinant, and
repeat.
Important: row (and column) operations can change the value of the determinant, so we must always
keep track of which operations we perform. (Unlike doing Gaussian elimination.)
6.2.5
Example
Calculate the determinant
2
1
3
0
6
1
3 2
.
4
4
4
6
5
2
2
2
1
0
5
6
1 0
(r 1
r 1 2r 2 )
2
3 2
3 2 1
=
4
4 0 4 5 10
(r 3
r 3 3r 2 )
2
4
6
4
6 0
1
0 5
= (1) 4 5 10 (expanding down column 1)
2
4 6
2
1
3
0
5
2
2
2
1
0
0
= (1) 4 5 30
2
4 4
5 30
=
4 4
2
1
3
0
5
2
2
2
6
3
4
4
(c3
1
2
4
6
= 20(1 6) = 100.
0
= 1
0
0
1
2
4
2
1
= (1) 4
2
0
5
4
5
10
6
1
= (1) 4
2
0
5
4
0
30
4
5
=
4
c3 5c1 )
(expanding along r 1 )
1
6
= (5) 4
1 1
30
4
1
= (5) 4
1
0
3
5
4
5
2
10
6
(r 1
r 1 2r 2 )
(r 3
r 3 3r 2 )
(c3
c3 5c1 )
(expanding along r 1 )
6
= 20(1 6) = 100.
1
Using the definition with cofactors, to calculate an n n determinant, we have to find n cofactors, each a
(n 1) (n 1) determinant. For each of these we need to find (n 1) cofactors of size (n 2) (n 2)
etc. The total number of calculations is about
n (n 1) (n 2) 3 2 = n!
81
For a 25 25, this is about 1025 operations. This would take thousands of years, even on a computer.
Doing row reductions, only a few thousand calculations are required, which could be done in a fraction
of a second on a computer.
6.2.6
Example
1 1 1
Evaluate a b c . This matrix is called Vandermondes matrix, and it occurs in applications such
a2 b2 c2
as signal processing, error-correcting codes, and polynomial interpolation.
1 1 1 1
1
1
a b c = 0 ba
c a (r 2
r 2 ar1 )
a2 b2 c2 0 b2 a2 c2 a2 (r
r 3 a2 r 1 )
3
ba
c a
= 2
(expand down first column)
b a2 c2 a2
Now we extract a common factor from each of columns 1 and 2 giving
1
1
= (b a)(c a)
b+a c+a
= (b a)(c a)[c + a (b + a)]
= (b a)(c a)(c b).
1
a
2
a
1
b
b2
1
= 0
2
0
c
1
c
ba
= 2
b a2
1
ba
2
b a2
c a
c2 a2
1
ca
2
c a2
(r
2
(r 3
6.2.7
(b a)(c a)
a11
a21 a22 0
.
..
Suppose A =
..
.
an1
0
..
.
..
.
0
ann
r 2 ar1 )
1
b+a
1
c+a
r3 a r1 )
82
6.3
6.3.3
Proof
= If A is invertible, then
I = AA1
1 = |I| = AA1 = |A| A1 ,
So |A| =
6 0.
= If A is invertible, then
1
I = AA
1 = |I| = AA1 = |A| A1 ,
So |A| =
6 0.
1
,
|A|
6.3.4
83
A Theoretical Formula
There is an explicit formula for the inverse of A. If Cij is the cofactor of the i, j entry of A, let C be the
matrix of cofactors C = (Cij ). Then
1 T
A1 =
C .
|A|
Here C T is called the adjoint matrix of A. This formula is useful for some theoretical problems, but is
useless as a tool for calculations because it is so time consuming to calculate all the cofactors.
Never use this formula for calculating inverses!
6.3.5
Example
a
a
|A| = 11 12
a21 a22
= a11 a22 a12 a21
and co-factors
C11 = a22
C12 = a21
|A| =
6 0 A1 =
1
|A|
C21 = a12
C11 C21
C12 C22
=
1
|A|
,
C22 = a11
a22 a12
a21
a11
Notes
84
85
7.1
For vectors v, w in R3 , the cross (or vector) product of v and w is a vector v w such that
(i) kv wk = kvk kwk sin , where is the angle between v and w
(ii) v w is perpendicular to v and w, in right hand direction from v w (right hand rule).
v xw
Vector products also arise naturally in physics and engineering eg. a particle of unit charge moving with
velocity v in a magnetic field B experiences a force F = v B. The angular momentum of a particle of
mass m moving with velocity v is given by L = m(r v) where r is the position vector of the particle.
This is important for central force problems.
7.1.2
(1)
For v, w 6= 0
v w = 0 sin = 0 = 0 or 180
(2)
(3)
v v = 0, since sin 0 = 0.
(4) If v w 6= 0, then v w is perpendicular to the plane determined by v and w. This is useful for
obtaining the equation of a plane in R3 (see Math 1052).
7.1.3
Example
ii = jj = kk
=
0
ij =
k
= j i j k = i = k j
ki =
j
= i k.
86
Figure 11: This diagram is an aid in remembering the cross product between unit vectors.
7.1.4
R.
v1
Suppose v = v2 ,
v3
ie.
w1
w = w2 . Then
w3
7.1.6
87
Proof
7.1.7
Example
Let v = (1, 2, 3), w = (4, 5, 6). Find a (non-zero) vector orthogonal to both v and w.
88
vw
i
j
k
1
2
3
4
5
6
2
3
j 1
i
4
5
6
1
3
+ k
6
4
3i + 6j 3k.
2
5
7.2
Find area of the ABC with vectors v, w along edges as shown in Figure 12.
Area =
=
Area
1
base perpendicular height
2
1
1
kvk kwk sin = kv wk .
2
2
=
=
1
2
1
2
1
2
kv wk .
7.2.1
89
Example
Find the area of a triangle with vertices A = (0, 1, 3), B = (1, 2, 1), C = (4, 1, 0) and obtain a vector
perpendicular to the plane of ABC.
w = AB = 1 ,
2
v = AC = 0
3
1
3i + 5j + 4k
2
1
9 + 25 + 16
2
1
50
2
5 2
.
2
=
=
=
w = AB =
1
1 ,
2
v = AC =
4
0
3
j
0
1
k
3
2
= 3i + 5j + 4k.
kv wk
=
=
=
=
7.3
1
3i + 5j + 4k
2
1
9 + 25 + 16
2
1
50
2
5 2
.
2
90
Set u = u1 i + u2 j + u3 k. Then
v2 v3
v1 v3
v1 v2
i
u (v w) = (u1 i + u2 j + u3 k)
w1 w3 j + w1 w2 k
w2 w3
v1 v2
v1 v3
v2 v3
+ u3
u2
= u1
w1 w2
w1 w3
w2 w3
u1 u2 u3
= v1 v2 v3 .
w1 w2 w3
This is a 3 3 determinant.
Set u = u1 i + u2 j + u3 k. Then
u (v w)
=
=
v
v2
v3
i 1
w2
w1
w3
v1
v
v3
v3
+
u3
u
u1 2
2 w
w3
w2
w3
1
u1
u2
u3
v1
v2
v3 .
w1
w2
w3
(u1 i + u2 j + u3 k)
v
v3
j + 1
w3
w1
v1
v2
w1
w2
v2
k
w2
This is a 3 3 determinant.
7.4
Geometrical Interpretation
vxw
w
A
7.4.1
91
Proof
w)
kv wk
kv wk2
From previous example,
area of the base ABCD = 2 (area ABD)
= kv wk
V = kv wk h = |u (v w)| .
perpendicular height
7.4.2
2 (area ABD)
kv wk
V = kv wk h = |u (v w)| .
Example
2
1
0 .
a=
, b=
, c=
1
1
1
V = |a (b c)|, where
1 2 1
a (b c) = 1 1 1
0 0 1
V = |1| = 1.
=1 1 2
1 1
= 1 2 = 1
(expanded along r3 )
V = |a (b c)|, where
a (b c)
1
1
0
|1| = 1.
2
1
0
1
1
1
=1 1
1
2
= 1 2 = 1
1
(expanded along r3 )
92
The volume V of a parallepiped determined by the vectors u, v, w vanishes if and only if vectors are
co-planar; therefore vectors are co-planar if and only if
u1 u2 u3
v1 v2 v3 = 0.
w1 w2 w3
This gives a useful method for determining when 3 vectors are co-planar.
Notes
93
94
8.1
Ranking Webpages
Web search engines assign a number to each webpage, called the pagerank. The higher the pagerank, the
higher that webpage is listed in websearches.
If a webpage links to 3 other pages, it passes one third of its rank to each of those pages. The pagerank
of a webpage is calculating by summing all the contributions from in-linking pages.
8.1.1
Example
/ 2
@ O
O ^
/ 4
3
Let the ranks of the pages be r1 , r2 , r3 , r4 .
The only page linking in to 4 is page 3. Page 3 links to 3 pages (1, 2, 4), so it passes 1/3 of its rank on
to each. So
1
r4 = r3 .
3
The rank of page 3 is given by:
The only page linking in to 3 is page 1. Page 1 links to 2 pages (2, 3), so it passes 1/2 of its rank on to
each. So
1
r3 = r1 .
2
The only page linking in to 3 is page 1. Page 1 links to 2 pages (2, 3), so it passes 1/2 of its rank on to each. So
r3 =
1
2
r1 .
1
1
r2 = r1 + r3 +
2
3
r1 gets weight 1/2 because page 1 links to 2 pages. r3 gets
r2 =
1
2
r1 +
1
3
r3 +
1
2
1
r4 .
2
weight 1/3 because page 3 links to 3 pages.
r4 .
r1 gets weight 1/2 because page 1 links to 2 pages. r3 gets weight 1/3 because page 3 links to 3 pages.
95
r1 =
r2 =
1
2 r1
r3 =
1
2 r1
r2 +
1
3 r3
1
2 r4
1
3 r3
1
2 r4
1
3 r3
r4 =
r1
r2
r2
1r
2 1
r3
1r
2 1
r4
1r
3 3
1r
2 4
1r
3 3
1r
2 4
1r
3 3
A=
0 1
1
3
1
2
1
3
1
2
0 0
A=
1
2
1
3
0 0
1
2
1
3
1
2
1
3
1
2
1
2
1
3
1
2
In general, the pagerank of v is calculated by adding the weight of all the pages w1 , . . . , wn that link in
to v:
X
r(wj )
r(v) =
.
nj
all pages w1 , . . . , wn that link to v
r=
r1
r2
..
.
rN
96
(8.1)
This is an N N system, but not one that we have seen before because the RHS is not constant. The
unknown vector r appears on both sides of the equation.
Equation (8.1) is called an eigenvector equation. The vector r is called an eigenvector of the matrix A.
Instead of the equation Ax = x, sometimes we often encounter equations like Ax = 2x. This is called
an eigenvector problem with eigenvalue 2. Equation (8.1) is a special case with eigenvalue 1.
8.2
Geometry of eigenvectors
A maps i 7
2
1
2 1
1 2
and j 7
1
2
2
. This acts as a linear transformation, mapping i 7
and
1
.
The vector
1
1
1
1
Check: A
97
is unchanged.
=
2 1
1 2
For most vectors Av 6= v, but
The vector
Check: A
1
1
1
1
1
1
1
1
=
1
1
.
is special for the matrix A. It is called an eigenvector of A.
is unchanged.
=
2
1
1
2
For most vectors Av 6= v, but
1
1
1
1
=
1
1
.
is special for the matrix A. It is called an eigenvector of A.
Instead of Ax = x we often encounter equations like Ax = 2x. Then 2 is called an eigenvalue, and x a
corresponding eigenvector. Above we looked at the special case of eigenvalue 1.
8.2.1
98
Other applications
Eigenvalues and eigenvectors have many other applications e.g. in Quantum Mechanics the energy of a
system is represented by a matrix whose eigenvalues give the allowed energies. This is why discrete energy
levels are observed. Another situation where they are used is in modelling the population dynamics of a
predator-prey system in biology. The eigenvalues and eigenvectors determine the stability and dynamics
of a population in such models.
There are many other applications in Mathematics, Physics, Chemistry and Biology.
8.3
(8.2)
with a number (possibly complex). We are given the matrix A, and need to find and x.
Obviously x = 0 is always a solution to (8.2) (for any ). A value for which (8.2) has solution x 6= 0
is called an eigenvalue of A. The corresponding solution vector x 6= 0 is called an eigenvector of A
corresponding to the eigenvalue .
Note that is allowed to be 0, but x is not allowed to be 0.
8.3.1
Example
1 3
4 2
eigenvector x.
Let A =
1
, = 2 and x =
. Show that is an eigenvalue for A, with corresponding
1
1
4
3
2
1
1
Check that another eigenvalue is = 5 with corresponding eigenvector
8.3.2
=
3
4
2
2
= 2
1
1
= x.
.
Note
8.4
99
We have
Ax
Ax
Ax Ix
(A I)x
=
x
= (Ix)
=
0
=
0.
(8.3)
The determinant
p() = |A I|
is a polynomial of degree n in called the characteristic polynomial of A. We call equation (8.3) the
characteristic equation.
Thus the eigenvalues of A are given by the roots of the characteristic equation (8.3). This means that
A has at least 1 and at most n distinct eigenvalues (possibly complex). The corresponding eigenvectors
may then be obtained for each in turn by solving
(A I)x = 0
using Gaussian elimination.
8.4.2
Example
5
2
2 2
.
100
We have
5
2
2
2
A I =
So
5
2
p() = |A I| =
2
2
.
= ( + 5)( + 2) 4
= 2 + 7 + 6 = ( + 6)( + 1).
Solving p() = 0 yields the eigenvalues 1 = 1, 2 = 6.
A I =
So
5
2
5
p() = |A I| =
2
We have
2
2
.
2
= ( + 5)( + 2) 4
2
= 2 + 7 + 6 = ( + 6)( + 1).
Solving p() = 0 yields the eigenvalues 1 = 1, 2 = 6.
1 = 1 :
2 1 0
2 1 0
0
0 0
with general solution
x=
=
1
1
is an eigenvector corresponding
2
2
to the eigenvalue = 1;
1 2 0
2 = 6 :
0 0 0
2
2
general solution x =
=
.
1
2
is an eigenvector corresponding to eigenvalue = 6.
1
Hence
1 2 0
2 4 0
2
1
0
2
1
2
1
0
0
1
0
1
2
0
0
0
1
2
1
2
is an eigenvector corresponding
to the eigenvalue = 1;
2 = 6 :
1
2
2
4
0
0
general solution x =
Hence
2
1
1
0
2
0
2
.
1
0
0
8.4.3
101
Example
2
p() = |A I| =
2
0 2
2 0
= 2 + 4.
x1 + ix2 = 0
2i 2 0
0 0 0
x1 = ix2 = i
1 i 0
0 0 0
x2 =
i
i
x =
=
is the general solution,
1
and
i
1
is an eigenvector corresponding to 1 = 2i.
For = 2i:
2i 2 0
2 2i 0
1 i 0
0
0 0
x1 ix2 = 0 x1 = ix2 = i
x2 =
x=
i
1
is the general solution, and
i
1
2
= 2 + 4.
2i
2
2
2i
0
0
x1 + ix2 = 0
2i
0
2
0
0
0
1
0
i
0
0
0
x1 = ix2 = i
x2 =
i
i
x =
=
is the general solution,
1
and
i
1
is an eigenvector corresponding to 1 = 2i.
For = 2i:
x=
2i
2
2
2i
0
0
1
0
i
0
0
0
x1 ix2 = 0 x1 = ix2 = i
=
i
1
x2 =
i
is the general solution, and
1
8.4.4
102
Check
Solving the system (A I)x = 0 to find eigenvectors always leads to at least one row of zeros when
A I is row reduced. This is because is chosen so that (A I)x = 0 has a solution x 6= 0.
So A I is not invertible and so A I does not reduce to I.
Notes
103
104
Vector Spaces
In this chapter we consider sets of vectors with special properties, called vector spaces.
Recall that if A and B are sets then A B means A is a subset of B. The set with no elements, called
the empty set is denoted . This is not the same as the set {0} whose single element is the zero vector.
9.1
Linear combinations
x
x
can be written using the vectors i and j:
= x i + y j. In R3 every
y
y
vector can be written using i, j, k. We generalize this idea.
In R2 , every vector
9.1.1
i R
Example
is a linear combination of
1
0
, w2 =
w1 =
0
1
1
1
v1 =
and v 2 =
.
1
1
105
Write
w 1 = 1
1
1
.
+ 2
1
1
Equating components:
1 + 2 = 1,
1 2 = 0
Solving, 1 = 2 = 1/2. So
w1 =
=
1 1
1
1 1
+
=
2 1
2 1
0
1
1
v1 + v2
2
2
Similarly we get
w2
0
1 1
1 1
=
=
1
2 1
2 1
=
1
1
v1 v2.
2
2
Write
w 1 = 1
1
1
+ 2
.
Equating components:
1 + 2
1,
1 2
Solving, 1 = 2 = 1/2. So
w1
1
0
1
2
v1 +
1
1
2
1
2
v2
Similarly we get
w2
9.1.3
0
1
1
2
v1
1
1
2
1
2
v2 .
Example
Every v =
v1
v2
..
.
vn
v = v1 e1 + v2 e2 + + vn en .
(9.1)
9.2
9.2.1
106
Linear independence
Definition: Linear independence
9.3
1 = 2 = = m = 0
Example
Show that in
R2 ,
the vectors
1
1
1
1
,
9.3.2
are linearly independent.
0
+
0
1
=
+
=
0
0
1
+ =0
= = 0.
=0
1
1
1
1
+
1
0
+
0
=
=
1
0
0
+ =0
= = 0.
=0
Example
1
0
..
.
107
+
n en =
0
1 e1+ 2 e2 +
1
0
0
.. 2
2
+ .. + + . = ..
0 .
.
0
0
..
.
1 = 0, 2 = 0, . . . , n = 0.
1
0
.
.
.
0
1 e1 + 2 e2 + + n en
0
0
.
2
+ + .. =
.
.
0
.
0
n
=0
1
2
..
.
n
0
0
= .
.
1 = 0, 2 = 0, . . . , n = 0.
9.3.3
Example
1
1
0
Show that in R3 , the vectors 3 , 1 , 1 are linearly dependent.
1
1
1
108
1
1 3 + 2
1
0
1
1
1 0
3
0
1 1
0
1 1 1
0
0
1
0
0
1 + 3 1 = 0
1
1
0
1 0
0
1 1
0
0
0 0 1 12
0 .
2 1
2 1
0 0
0
0
0
1
2
1
1
1
1
= 2, x = 1 is a solution.
2
Check:
1
1
0
0
3 1 2 1 = 0 .
1
1
1
0
We have found a non-trivial linear combination summing to 0, so the vectors are linearly dependent.
1
1
0
0
1 3 + 2 1 + 3 1 = 0
1
1
1
0
1
3
1
1
1
1
1
0
0 0
0
0
0
1
1
1
2
2
1
0
0 0
0
0
0
1
1
1
2
1
2
1
1
0
0
1
2
0
0
0 .
0
1
for any . If we take = 2, x = 1 is a solution.
2
Check:
0
0
1
1
3 1 2 1 = 0 .
0
1
1
1
We have found a non-trivial linear combination summing to 0, so the vectors are linearly dependent.
9.3.4
Example
Show that any finite set of vectors containing the zero vector 0 is linearly dependent.
S linearly dependent.
S linearly dependent.
9.3.5
If two vectors v 1 , v 2 are linearly dependent, then there exist scalars 1 , 2 R, not both 0, with
1 v 1 + 2 v 2 = 0.
109
1
2 v 1 ,
so v 2 is a
So two vectors are linearly dependent if and only if one of them is a multiple of the other.
(ii) If one vector v is linearly dependent then v = 0 with 6= 0, so v = 0. Thus a single vector is
linearly dependent if and only if it is the zero vector.
9.4
There is a relation between the nullspace of A and between linear independence of the columns of A.
b1
b2
0 = Ab = A b1 e1 + b2 e2 + + bn en
= b1 (Ae1 ) + b2 (Ae2 ) + + bn (Aen ).
We saw earlier that Aej is the jth column vector of A. So the right hand side is a linear combination
among the columns of A.
Thus: if there is a vector b NS(A) with b 6= 0 then there is a non-trivial linear combination of columns
of A adding up to 0, so the columns of A are linearly dependent.
Conversely, if the columns of A are dependent there is a non-trivial linear combination of columns of
A adding up to 0, say b1 (Ae
1) +
b2 (Ae2 ) + + bn (Aen ) = 0. This gives a non-zero vector b =
b1
b2
b1 e1 + b2 e2 + + bn en =
in NS(A).
bn
Thus: NS(A) = {0} if and only if the columns of A are linearly independent. But recall (5.3.2) that A
is invertible exactly when NS(A) = {0}.
We have proved:
9.4.1
Let A be a square matrix. Then A is invertible if and only if the columns of A are linearly independent.
Notice this means swapping the columns of a matrix does not affect whether or not it is invertible.
A is invertible AT is invertible
columns of AT are linearly independent
rows of A are linearly independent.
9.4.2
110
Example
1 1 0
A= 3 1 1
1 1 1
are linearly dependent. Therefore A is not invertible.
9.4.3
Let
Example
1 1 1
A= 0 1 1
0 0 1
It may be shown that the columns of A are linearly independent (left as an exercise). Therefore A is
invertible.
9.4.4
9.4.5
Let A be an n n matrix. Give a summary of all the conditions we have found that are equivalent to A
being invertible.
111
1. A is invertible.
2. There exists an n n matrix X with AX = XA = I
3. AT is invertible
[ 5.3.4(3)].
[ 9.4.1].
[ 9.4.1].
[ 5.3.2 ].
[ 5.3.2 ].
[ 4.4].
[Theorem 6.3.2].
10. rank A = n.
1. A is invertible.
2. There exists an n n matrix X with AX = XA = I
3. A
is invertible
[ 5.3.4(3)].
[ 9.4.1].
[ 9.4.1].
[ 5.3.2 ].
[ 5.3.2 ].
[ 4.4].
[Theorem 6.3.2].
10. rank A = n.
9.5
Vector spaces
x
y
| x + y = 2 . The set V is a set of (infinitely many) vectors in R2 .
The set containing just the zero vector {0}. This is a set with just one vector.
W =
x
y
|
x2
y2
= 0 . Since x2 , y 2 0, the only vector in W is 0, so W = {0}.
Another special set is the empty set, not containing any vectors at all(!) e.g.
x
2
2
Y =
| x + y = 1 . There are no vectors in Y .
y
Let V = b a + b = 2c .
112
1
1
2
Is 0 V ? No: 1 + 0 6= 2 3. But v = 1 , w = 4 V :
3
1
3
3
Is v + w V ? Yes: v + w = 5 and 3 + 5 = 2 4.
4
1 + 1 = 2 1 and 2 + 4 = 2 3.
We now consider sets of vectors with certain properties, called vector spaces.
9.5.1
Example
Show that
is a vector space.
a
V = b a + b = 2c, a, b, c R
113
(o) V is non-empty
V.
since 0
a1
a2
Let v = b1 , w = b2 be in V .
c1
c2
a1 + a2
b1 + b2
(i) v + w =
c1 + c2
v V a1 + b1 = 2c1
w V a2 + b2 = 2c2 .
Is v + w in V ?
(a1 + a2 ) + (b1 + b2 ) = (a1 + b1 ) + (a2 + b2 )
= 2c1 + 2c2 = 2(c1 + c2 )
v + w V . So V is closed under addition.
a1
a2
Consider v = b1 , w = b2 V .
c1
c2
a1
(ii) If is any scalar then v = b1
c1
(o) V is non-empty
since 0 V.
a1
a1
2
1
1
1
1
Let v = b1 , w = b2 be in V .
c1
c2
a + b = (a + b ) = 2c = 2(c1 )
v V. So V is closed under scalar multiplication.
a1 + a2
(i) v + w = b1 + b2
c1 + c2
v V a1 + b1 = 2c1
w V a2 + b2 = 2c2 .
Is v + w in V ?
(a1 + a2 ) + (b1 + b2 ) = (a1 + b1 ) + (a2 + b2 )
= 2c1 + 2c2 = 2(c1 + c2 )
a1
Consider v = b1 ,
c1
a2
w = b2 V .
c2
a1
(ii) If is any scalar then v = b1
c1
9.5.3
Example
Is V ={0}
a vector space?
v V. So V is closed under scalar multiplication.
Hence V is a vector space.
(o) 0 V V is non-empty.
(i) If v, w V then v = w = 0 and v + w = 0 V .
(ii) If R, then 0 = 0 V .
(o) 0 V V is non-empty.
(i) If v, w V then v = w = 0 and v + w = 0 V .
(ii) If R, then 0 = 0 V .
9.5.4
114
Example
(o) 0 V
(i) v, w V v + w Rn = V
(ii) v V v Rn = V
So V is a vector space.
(o) 0 V
(i) v, w V v + w Rn = V
(ii) v V v Rn = V
So V is a vector space.
9.5.5
Example
Is V =
1
2
a vector space?
No, since 0
/ V.
/ V.
No, since 0
9.5.6
Example
1
Is V =
| R a vector space?
2
115
(o) = 0 0 V .
(i) If v, w V then v =
1
2
and w =
1
2
for suitable , R.
v+w =
+
2
+
=
2( + )
1
= ( + )
V.
2
Then
(ii) If R, then v =
1
2
V.
1
2
and w =
1
2
for suitable , R.
Then
v+w
=
=
=
(ii) If R, then v =
1
2
+
2
+
2( + )
1
( + )
V.
2
V.
Geometrically, all these vectors can be viewed as lying along a single line through the origin.
9.5.7
Example
9.6 Eigenspace
116
If we draw v 1 and v 2 starting from the origin, then all these combinations 1 v 1 + 2 v 2 will lie in a single
plane in R3 , through the origin.
For example, if v 1 = i and v 2 = j then V = {1 i + 2 j | 1 , 2 R} is the set of vectors with no
k-component i.e. the xy plane.
Thus geometrically, a vector space can be a single point {0}, or can be all vectors along a single line
through the origin, or all vectors lying in a single plane through the origin, or similarly in higher dimensions.
Theorem: If A is a matrix, then NS(A) is a vector space.
Proof:
(o) A0 = 0
0 NS(A)
NS(A) is non-empty.
(i) v, w NS(A) Av = 0, Aw = 0
A(v + w) = Av + Aw = 0 + 0 = 0
v + w NS(A)
0 NS(A)
NS(A) is non-empty.
(i) v, w NS(A)
Av = 0, Aw = 0
A(v + w) = Av + Aw = 0 + 0 = 0
v + w NS(A)
This explains why either NS(A) = {0} or else it is infinite. If there is any solution v of Av = 0, there will
be infinitely many solutions. This is why a consistent linear system can have one solution, or infinitely
many, depending on the size of NS(A).
9.6
9.6.1
Eigenspace
Proposition (eigenspace is a vector space)
Let A be a square matrix. Let be an eigenvalue of A. Then the set of solutions of the equation Ax = x
forms a vector space called the eigenspace of A corresponding to eigenvalue , denoted N . So
N = {x Rn | Ax = x}.
Special case: if = 0 is an eigenvalue of A then N0 = {x Rn | Ax = 0} = NS(A), the nullspace of A
as above.
9.6.2
117
Proof
Ax + Ay
x + y
(x + y)
x + y N .
(ii)
A(x)
Ax
(x)
x N .
Hence the set of solutions to Ax = x forms a vector space.
(o) Note that 0 is always a solution to Ax = x, so 0 N .
Take x, y N , R.
(i) Then
A(x + y)
Ax + Ay
x + y
(x + y)
x + y N .
Ax
(x)
x N .
(ii)
A(x)
This is why when we found eigenvectors previously, we actually found infinitely many eigenvectors for
each .
9.7
We would like a compact way to describe all the vectors in a vector space V , and a way of generating a
vector space from a given set of vectors.
9.7.1
Definition: Span
The span of vectors v 1 , v 2 , ..., v m Rn is the set of all possible linear combinations of these vectors:
n
o
span{v 1 , v 2 , ..., v m } = 1 v 1 + 2 v 2 + + m v m | 1 , 2 , . . . , m R .
118
Example
3
5
Show that v =
is in span
1
1
1
,
.
1
3
1
1
We want
=
+
.
5
1
1
Solving, = 4, = 1. We want 35 =
1
1
+
1
1
.
Solving, = 4, = 1.
9.7.3
Example
Let v =
v1
v2
1
+ 2
v = 1
1
So we need:
(
v 1 = 1 + 2
v 2 = 1 2
1 + 2
1
=
.
1
1 2
1 = (v1 + v2 )
2
.
2 = (v1 v2 )
2
Hence
1
1
1
1
v1
v1 + v2
v1 v2
v=
=
+
.
1
1
v2
2
2
1
1
2
.
So any vector in R can be written as a combination of
and
1
1
3
The previous example was v =
, so v1 = 3, v2 = 5 so 12 (v1 + v2 ) = 4,
5
v=
v1
v2
1
+ 2
1
So we need:
v 1 = 1 + 2
v 2 = 1 2
v = 1
Hence
1
1
=
1 + 2
1 2
.
1 = (v1 + v2 )
2
.
2 = (v1 v2 )
2
1
1
1
v1 v2
+
.
1
1
2
1
1
So any vector in R2 can be written as a combination of
and
.
1
1
3
1
1 (v v ) = 1.
The previous example was v =
, so v1 = 3, v2 = 5 so 2 (v1 + v2 ) = 4, 2
1
2
5
v=
v1
v2
1
2
v1 + v2
1
2 (v1
v2 ) = 1.
Let
9.7.4
119
Example
1
1
1
Show that span 0 , 1 , 1 = R3 .
0
0
1
a
Let v = b R3 be arbitrary. We need to find , , R such that
c
1
1
1
v = 0 + 1 + 1 .
0
0
1
That is,
+ + = a
+ + = b
= c
Back substitution gives = c, = b c, = a b. So
a
1
1
1
v = b = (a b) 0 + (b c) 1 + c 1 .
c
0
0
1
a
Let v = b R3 be arbitrary. We need to find , , R such that
c
1
1
1
v = 0 + 1 + 1 .
0
0
1
That is,
+
+
=
+
+
=
=
a
b
1
a
1
1
v = b = (a b) 0 + (b c) 1 + c 1 .
1
c
0
0
9.7.5
Example
1
Find a spanning set for V =
|R .
2
9.8 Bases
120
1
1
Every vector in V is a linear combination of
, so a spanning set is
.
2
2
1
This answer is not unique. For example
is another spanning set for V .
2
1
, so a spanning set is
.
2
1
This answer is not unique. For example
is another spanning set for V .
2
combination of
9.7.7
1
2
Example
0
..
.
0
0
these vectors (see equation 9.1).
9.7.8
Example
The vector space {0} is spanned by the zero vector 0 Rn is and called the zero vector space.
9.8
Bases
We have seen that we can describe a vector space by giving a spanning set. When we do this, we usually
like to choose a spanning set that is as small as possible (contains no redundancies). We ensure this as
follows.
9.8.1
Definition: Basis
Let V be a vector space. We say that a set of vectors B = {v 1 , ..., v m } V is a basis for V if:
1. B spans V ;
2. B is linearly independent.
To prove that a set of vectors is a basis, we must prove both properties.
Sometimes we are just given a vector space V , and asked to find a basis. Problems like this are solved
by finding a spanning set for V , and then checking that the set is linearly independent.
A single vector space V may have many different bases.
9.8.2
Example
We have seen that the coordinate vectors ei , i = 1, ..., n, are linearly independent (section 9.3.2) and
span Rn (section 9.7.7). Therefore they form a basis for Rn , called the standard basis.
9.9 Dimension
9.8.3
121
Example
1
1
,
1
1
Note that this basis differs from the standard
9.8.4
1
0
0
,
basis of R2 , but still has two elements.
1
Example
V = b a + b = 2c , a, b, c R
2c b
2c
b
= 0 + b = cv 1 + bv 2
b
v=
c
c
0
with c, b R. Thus {v 1 , v 2 } is a spanning set for V . For {v 1 , v 2 } to be a basis, we need to show v 1 and
v 2 are linearly independent. If 1 v 1 + 2 v 2 = 0 then from the second coordinate 2 = 0 and from the
first 1 = 0, so {v 1 , v 2 } is also linearly independent. Any vector in V is of the form
v=
2c b
2c
b
= 0 + b = cv + bv
b
1
2
c
c
0
with c, b R. Thus {v 1 , v 2 } is a spanning set for V . For {v 1 , v 2 } to be a basis, we need to show v 1 and v 2 are linearly independent. If 1 v 1 + 2 v 2 = 0
then from the second coordinate 2 = 0 and from the first 1 = 0, so {v 1 , v 2 } is also linearly independent.
9.9
Dimension
Suppose B = {v 1 , ..., v m } is a basis for V . Then it can be shown that every basis for V has m vectors.
We call m the dimension of V and write m = dim V . (By convention, the zero vector space {0} has
dimension zero.)
9.10 Components
9.9.1
122
Example
Example
1
2
(example 9.7.6) which thus constitutes a basis for V . Hence dim V =
1.
Geometrically, V consists of vectors along a single line, which is a one dimensional object.
9.9.3
Example
b
V =
a + b = 2c , a, b, c R
c
In example 9.8.4 we found a basis with 2 vectors, so dim V = 2. Note that V is a subspace of R3 , but it
consists of a plane through the origin, which geometrically is a two dimensional object.
9.10
Components
123
v v = (1 v 1 + + m v m ) (1 v 1 + + m v m )
(1 1 )v 1 + + (m m )v m .
9.11
Example
1
v1 = 0 ,
0
1
v2 = 1
0
1
v3 = 1
1
124
Setting v 1 + v 2 + v 3 = 0 implies
1
1
1
0
0
1
1
0
+
+
=
0
0
1
0
++
0
+
0
0
=0=0=0
Therefore the vectors are linearly independent.
Because we already know dim R3 = 3 and we have found 3 linearly independent vectors, they must form
a basis, by (vi) above.
(Alternatively: we proved they span in example 9.7.4.) Setting v1 + v2 + v3 = 0 implies
1
1
1
0 + 1 + 1
0
0
1
++
0
0
0
0
0
0
=0 =0=0
Therefore the vectors are linearly independent.
Because we already know dim R3 = 3 and we have found 3 linearly independent vectors, they must form a basis, by (vi) above.
(Alternatively: we proved they span in example 9.7.4.)
The shortcut in this example is fine if we already know the dimension of V . If we are just given a space
like
b
V =
a + b = 2c , a, b, c R
c
it may not be obvious what the dimension is.
Notes
125
10
126
Numbers
Mathematics uses structures at a fundamental level. These basic structures include numbers, sets (e.g.
intervals), shapes, vectors, complex numbers, quaternions and many more strange and exotic things.
Numbers are very important in mathematics as building blocks as they lead to equations and inequalities
which we can use as a tool to solve many abstract and applied problems.
10.1
Number systems
R:
N:
Z:
Q:
Irrational
numbers are real numbers which cannot be represented as a ratio of integers. For example,
2, 3, 5, = 3.14159 . . ., e = 2.71828 . . . are all irrational. Note: proving rationality or irrationality
of a given number can be quite subtle!
10.2
The real number system can be visualised by imagining each real number as a point on a line, with the
positive direction being to the right, and an arbitrary origin being chosen to represent 0 (see Figure 14).
1.5
3
e
1
10.3
Definition: Intervals
An interval is a set of real numbers that can be thought of as a segment of the real number line. For
a < b, the open interval from a to b is given by
(a, b) = {x R| a < x < b}.
This notation is interpreted as
127
Note here that the end points are not included. If we wanted to include the endpoints, we would have a
closed interval from a to b, denoted
In this notation it is important to distinguish between the round brackets (a, b) for an open interval
(excluding the end points) and the square brackets [a, b] for a closed interval (including the end points).
We also have half-open intervals (or half-closed depending on how you feel), denoted
10.4
128
Absolute value
We define
|x| =
10.4.1
x,
if x 0
x, if x < 0
Examples
|3| =
| 4| =
|1 | =
10.4.2
10.4.3
Convention for
For a > 0, a always denotes the positive solution of x2 = a. Thus 4 = 2 and so on. This means that
Notes
129
Notes
130
11
11.1
131
Functions
Notation
11.2
A function f : X Y is a rule which assigns to every element x X exactly one element f (x) Y
called the value of f at x. X is called the domain of f and
f (X) = {f (x)| x X}
is called the range of f .
The range of f , f (X), is a subset of Y . In other words, you can take any x value from X, plug it into f ,
and return the value f (x), which is in Y . The range is the set of all possible values of f (x) as x varies
throughout the domain. Note that f (X) is not necessarily equal to all of Y .
11.2.1
Example
The function f : R R, such that f (x) = x2 is a function with domain R. The range is given by
f (R) = {f (x) | x R}
=
=
11.2.2
Example
5 , 6 < x < 0
, x = 0
g(x) =
x , 0<x<7
Piecewise defined functions are discussed in Stewart, 7ed. p. 16; 6ed. p. 17.
11.3 Graphs
132
Clearly the domain of g is the open interval (6, 7), but what about the range? Looking at the algebraic
expression for g given above, the range can be expressed as
11.3
Graphs
We can represent a function by drawing its graph which is the set of all points (x, y) in a plane where
y = f (x).
11.3.1
Example
11.3.2
133
Example
11.4
Convention (domain)
An expression like the function y = 1 x2 means the function f with y = f (x) = 1 x2 . When
the domain is not specified it is taken to be the largest set on which the rule is defined. In this example,
the domain would be [1, 1].
11.5
Caution (non-functions)
Sometimes we see equations for curves which are not functions. Consider the equation of a circle of radius
1, centred at the origin: x2 + y 2 = 1. The crucial function property states that for each value x in the
domain there must correspond exactly one value y in the range. If there are any more y values, then it
is not a function.
11.6
134
In the graph of a function, the vertical line x =constant must cut the graph in at most one point. The
graph for the circle x2 + y 2 = 1 is given in Figure 18. We can clearly seethat the vertical line intersects
the circle at two points. In this case the two y values are given by y = 1 x2 . Therefore x2 + y 2 = 1
does not give rise to a function on any domain intersecting (1, 1).
y
Figure 18: The circle x2 + y 2 = 1 with a vertical line intersecting at two points. This shows that the
equation for a circle does not give rise to a function.
11.6.1
Example
Both y = 1 x2 (the top half of the circle) and y = 1 x2 (the bottom half of the circle) are
functions of x. What are the domains and ranges of these two functions?
11.6.2
135
Example
Look at the graphs in Figures 19(a) and 19(b). Do either of these graphs represent functions?
y
(a)
(b)
11.7
Exponential functions
An exponential function is one of the form f (x) = ax , where the base a is a positive constant, and
x is said to be the exponent or power. One very common exponential function which we shall see often in this course is given by f (x) = ex . It has the graph shown in Figure 20. Notice that it cuts
the y-axis (the line x = 0) at y = 1. This graph was made using MATLAB with the command
ezplot(exp(x),[-1.75,1.75,-4,6]).
exp(x)
6
5
4
3
2
1
0
1
2
3
4
1.5
0.5
0
x
0.5
1.5
11.7.1
136
Properties of exponents
Exponential functions are very useful for modelling many natural phenomena such as population growth
(base a > 1) and radioactive decay (base 0 < a < 1).
11.7.2
Example
This example is from Stewart, 5ed. p. 426. It does not appear in the 6th or 7th editions.
The half-life of the isotope strontium-90, 90 Sr, is 29 years. This means that half of any quantity of 90 Sr
will disintegrate in 29 years. Say the initial mass of a sample is 24mg, write an expression for the mass
remaining after t years.
11.8
137
In calculus, we measure angles in radians. One radian is defined as the angle subtended at the centre of
a circle of radius 1 by a segment of arc length 1.
1 rad
1
360
= ,
2
2
= x.
360
The point on the unit circle x2 + y 2 = 1 making an angle (in radians) anti-clockwise from the x-axis has
coordinates (cos , sin ), so cos2 + sin2 = 1. This defines the cos and sin functions. This relationship
is shown in Figure 22.
y
1
(cos , sin )
sin
x
cos
Figure 22: The relationship between the cosine and sine functions.
138
The graphs of the functions cos and sin are shown below in Figure 23. Note how the two functions
have the same behaviour, but are shifted (i.e. phase shifted)) by 2 . This leads to the relationship
cos = sin
= sin +
.
2
2
cos(x), sin(x)
cos(x)
sin(x)
0.5
0.5
1
6
0
x
Figure 23: The relationship between the cosine and sine functions.
In both cases in Figure 23 the range is [1, 1]. There are some unmarked vertical dotted lines. What
values do they represent? (This graph was made using MATLAB. To get both curves on the same axes,
we used the hold on command.)
The tan function is related to the sine and cosine functions by
It is defined for cos 6= 0. It is therefore not defined at values of which are odd integer multiples of
5
(eg 2 , 3
2 , 2 etc).
The graph of tan is given in Figure 24 below. Mark the x values in the graph where the function is not
defined.
tan(x)
6
4
2
0
2
4
6
6
0
x
139
cot x =
cot (x)
6
6
6
1
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
8
0
x
x
2
140
sinx, sin(2 x)
sin(x)
sin(2x)
1
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
8
0
x
1/2 cos(x)
3cos(x)
3
8
0
x
1
2
4
3
2
1
0
1
2
3
4
5
20
15
10
0
x
10
x
3
15
20
and 2 sin(5x).
11.8.1
141
Example
Suppose that the temperature in Brisbane is periodic, peaking at 32 degrees Celsius on January 1, and
sinking to 8 degrees Celsius in June; see Figure 30. Use the cosine function to model temperature as a
function of time (in days).
35
30
temperature
(T)
25
20
15
10
50
100
150
200
time, (t)
250
300
350
11.10 One-to-one (1-1) functions - Stewart, 7ed. pp. 384-387; 6ed. pp. 385-388
11.9
142
Composition of functions
Let f and g be two functions. Then the composition of f and g, denoted f g, is the function defined by
11.9.1
Example
f (x) = x2 + 1, g(x) =
1
. Their compositions f g and g f are given by
x
Notice how these two composite functions are not equal. In general, f g 6= g f .
11.10
One-to-one (1-1) functions - Stewart, 7ed. pp. 384-387; 6ed. pp. 385-388
On the graph y = f (x), 1-1 means that any horizontal line y =constant cuts through the curve in at
most one place; see Figure 31.
11.10 One-to-one (1-1) functions - Stewart, 7ed. pp. 384-387; 6ed. pp. 385-388
y
143
y
(a)
(b)
11.10.1
Example
Show from the definition that the function f (x) = e2x5 is 1-1 on its domain.
11.11
144
Inverse Functions
Let f : X Y be a 1-1 function. Then we can define the inverse function, f 1 : f (X) X by
By definition,
Note that y = f (x) x = f 1 (y), and that (f 1 (y))1 = f (x). The function f must be 1-1 in order
that f 1 satisfy the crucial function property. In order to obtain the graph of f 1 (x), we reflect the
graph of f (x) about the line y = x; for example, see Figure 32 below. The dashed line represents the
graph of the inverse function, having been reflected about the line y = x.
y
y=f
y=x
(x)
y=f(x)
x
11.11.1
145
Example
Draw the graph of the inverse function of f (x) = x3 (the cube root function f 1 (x) = x1/3 ) on the same
axes given below in Figure 33.
x3
2
1.5
1
0.5
0
0.5
1
1.5
2
2
1.5
0.5
0
x
0.5
1.5
11.11.2
Example
f : R R, f (x) = x2 is not 1-1 and therefore has no inverse. However, x 0 gives a 1-1 function
f : [0, ) R, f (x) = x2 with range [0, ). The inverse of this function is then f 1 : [0, ) [0, ),
f 1 (x) = x. Similarly the negative half of the function f (x) = x2 is 1-1, with inverse f 1 : [0, )
(, 0], f 1 (x) = x.
This technique is often used when the function is not 1-1 over its entire domain: just take a part where
it is 1-1 and determine the inverse for that part.
For further discussion on how to find the inverse function of a 1-1 function, see Stewart, 7ed. p. 387; 6ed.
p. 388 box 5.
11.12
146
3x
8
7
6
5
2x
4
3
2
1
0
1
4
0
x
x R,
aloga x = x
x > 0.
11.13
Natural logarithm
Now we set a = e (Eulers number = 2.71828. . .). The inverse function of f (x) = ex is
loge (x) ln x.
147
6
exp(x)
5
3
log(x)
2
3
3
11.13.1
Properties
Using exponent laws, together with the fact that ln x is the inverse function of ex , we can prove the
following.
11.13.2
148
If a bacteria population starts with 100 bacteria and doubles every 3 hours, then the number of bacteria
n after t hours is given by the formula
n = f (t) = 100 2t/3 .
(a) Find the inverse of this function and explain its meaning.
(b) When will the population reach 50000?
11.13.3
149
Example
Suppose that there are 1000 rabbits on January 1. Thirty days later there are 1500 rabbits. Assuming
that the population grows exponentially, find an expression for the rabbit population at time t.
11.14
150
The function y = sin x is 1-1 if we just define it over the interval [/2, /2]; see Figure 23. The inverse
function for this part of sin x is denoted arcsin x. Thus arcsin x is defined on the interval [1, 1] and takes
values in the range [/2, /2]. The graph can easily be obtained by reflecting the graph of sin x about
the line y = x over the appropriate interval; see Figure 36.
sin x, arcsin x
1.5
0.5
0.5
sin x
1
arcsin x
1.5
1.5
0.5
0.5
1.5
Figure 36: f (x) = sin x defined on [/2, /2] reflected about the line y = x to give f 1 (x) = arcsin x.
Similarly y = cos x is 1-1 on the interval [0, ] and its inverse function is denoted arccos x. The function
arccos x is defined on [1, 1] and takes values in the range [0, ]. Figure 37 below shows the graphs of
f (x) = cos x before and after reflection about the line y = x. This gives the graph of f 1 (x) = arccos x.
cos x, acos x
3
2.5
arccos x
2
1.5
1
0.5
0
cos x
0.5
1
1
0.5
0.5
1
x
1.5
2.5
Figure 37: f (x) = cos x defined on [0, ] reflected about the line y = x to give f 1 (x) = arccos x (written
in MATLAB as acos(x)).
151
Also, tan x is 1-1 on the open interval (/2, /2) with inverse function denoted by arctan x. Hence
arctan has the domain (, ) with values in the range (/2, /2).
tan x, atan(x)
10
tan x
8
6
4
2
0
arctan x
2
4
6
8
10
10
10
Notes
152
Notes
153
Notes
154
Notes
155
12
156
Limits
Limits arise when we want to find the tangent to a curve or the velocity of an object, for example. Once
we understand limits, we can proceed to studying continuity and calculus in general. You should be
aware that limits are a fundamental notion to calculus, so it is important to understand them clearly.
12.1
Let f (x) be a function and ` R. We say f (x) approaches the limit ` (or converges to the limit `) as x
approaches a if we can make the value of f (x) arbitrarily close to ` (as close to ` as we like) by taking x
to be sufficiently close to a (on either side of a) but not equal to a.
We write
lim f (x) = `.
xa
Roughly speaking, f (x) is close to ` for all x values sufficiently close to a, with x 6= a. The limit predicts
what should happen at x = a by looking at x values close to but not equal to a.
12.1.1
Precise Definition
Let f be a function defined on some open interval that contains the number a, except possibly a itself.
Then we write
lim f (x) = `
xa
157
14
14
12
12
10
10
10
Function 1
10
Function 2
2x
2x + 20
for 0 x 5,
for 5 < x 10,
2x
2
g(x) =
2x + 20
for 0 x < 5,
for x = 5,
for 5 < x 10.
f (x) =
while function 2 is described by
Each function has a limit of 10 as x approaches 5. It does not matter that the value of the second
function is 2 when x equals 5 since, when dealing with limits, we are only interested in the behaviour of
the function as x approaches 5.
12.1.2
158
Properties
Suppose that c is a constant and the limits ` = lim f (x) and m = lim g(x) exist for some fixed a R.
xa
xa
Then
12.1.3
Example
12.1.4
159
12.1.5
160
xa
means that the values of f (x) can be made arbitrarily large by taking x sufficiently close to a, but not
equal to a.
Similarly,
lim f (x) =
xa
means that the values of f (x) can be made arbitrarily large negatively by taking x sufficiently close to
a, but not equal to a.
In these cases, we say that f (x) diverges to . We also say that the limit does not exist in these cases.
Note that the limit properties in section 12.1.2 do not necessarily apply if the limits diverge.
12.2
One-sided limits
1, x 0
2, x < 0.
f (x) =
Notice that
lim
x0,x>0
f (x) = 1, but
lim
x0,x<0
161
Similarly, we say that the limit as x 0 from below (or from the left) equals 2 and we write
lim f (x) = 2.
x0
In general, for lim f (x) = `, just consider x with x > a and similarly for lim f (x) = `, consider only
xa+
xa
x < a.
12.2.1
Example
x2+
12.2.2
x 2 and lim
x2
Theorem
xa
12.2.3
Example
x2 , x 1,
2 x, x < 1.
x2
x 2 exist?
12.3
162
Suppose
lim g(x) = ` = lim h(x)
xa
xa
g(x)
f(x)
l
h(x)
a
12.3.1
Example
12.4
163
1
= 0.
x
We say that f (x) approaches ` as x if f (x) is arbitrarily close to ` for all large enough values of x.
Formally, we write:
That is, f (x) can be made arbitrarily close to ` by taking x sufficiently large. Similarly, we write
164
Note:
1
= 0 and
x x
lim
1
= 0.
x x
lim
1/x
10
8
6
4
2
0
2
4
6
8
10
10
0
x
10
12.4.1
Example
12.4.2
2x2 + 3
.
x 3x2 + x
Find lim
12.4.3
Example
8x3 + 6x2
.
x 4x3 x + 12
Find lim
12.4.4
x2 + 5
.
x x + 1
Find lim
165
12.4.5
166
x+1
x x2 + 1
Find lim
The general method in the four previous examples has been to:
1. divide the numerator and denominator by the highest power of x in the denominator; and then
2. determine the limits of the numerator and denominator separately.
12.5
The following limits are fundamental. Combined with the properties given in 12.1.2 and the Squeeze
Principle given in 12.3, these will enable you to compute a range of other limits.
Here a R is arbitrary.
(1)
(4)
lim 1 = 1
(2)
1 cos(x)
1
=
2
x0
x
2
(5)
xa
lim
lim x = a
xa
ex 1
= 1.
x0
x
lim
(3)
sin x
=1
x0 x
lim
Notes
167
Notes
168
Notes
169
13.2 Representations
13
170
Sequences
13.1
More formally, a sequence is a function, with domain being N0 = {0, 1, 2, 3, . . . }. We can also take the
domain as N = {1, 2, 3, ...} and start the sequence at a1 rather than a0 .
13.1.1
Motivation
Infinite sequences of numbers are useful in many applications. The sequence might represent approximations to the solution of a problem such as the bisection method. Or the sequence might represent a time
series, where the numbers represent the population each year. Mathematically, we are interested in how
the sequence behaves as the number of terms becomes large: does it converge to a solution, or how fast
does the population grow? Sequences can also appear from the partial sums in an infinite series, which
comprises our next major topic.
13.2
Representations
There are two main ways to represent the nth term in a sequence. Firstly, there is a direct (or closed
form or functional) representation. Secondly, there is a recursive (or indirect) representation.
13.2 Representations
171
The recursive form can have a simpler structure. It might be that an = f (an1 , an2 ) or even an =
f (an1 ). Depending on the problem, it can be natural to express the formula in one or the other way.
13.2.1
Example
13.2.2
n
.
n+1
Example
1
with a1 = 2.
3 an
Note that for the recursive form, you must express one or more initial conditions or starting values. The
recursive form is actually a difference equation, and there are similarities with differential equations that
are studied in MATH1052.
13.2.3
13.3 Application: Rabbit population - Stewart, 7ed. p. 726 ex. 83; 6ed. p. 722 ex. 71
13.3
172
Application: Rabbit population - Stewart, 7ed. p. 726 ex. 83; 6ed. p. 722
ex. 71
Suppose that rabbits live forever and that every month each pair produces a new pair which becomes
productive at age 2 months. Starting with one newborn pair, how many pairs of rabbits will be there in
the nth month?
13.4 Limits
13.4
173
Limits
Let {an }
n=0 be a sequence. Then
lim an = `
` R,
means :
an approaches ` as n gets larger and larger, ie. an is close to ` for n sufficiently large.
This is similar to lim f (x) = `, except here an is defined only for natural numbers n.
x
13.4.1
Convention
If a sequence {an }
n=0 has limit ` R, we say that an converges to ` and that the sequence {an }n=0 is
convergent. Otherwise the sequence is divergent.
13.4.2
Examples
Determine if the sequences {an }, with an as given below, are convergent and if so find their limits.
1. an =
1
n
1
2. an = an1 , a0 = 1.
2
174
3. an = (1)n
1
4. an = rn , for r = , r = 1, r = 2
2
13.5
The following limit laws apply provided that the separate limits exist (that is {an } and {bn } are convergent):
13.6
175
Theorem: Squeeze
13.6.1
Example
13.7
1
sin(n).
n
0,
1,
if |c| < 1
if c = 1.
Sequence {cn }
n=0 is divergent if c = 1 or |c| > 1.
(3) lim
n nr
= 0 for r > 0.
(5) lim
n = 1.
1
= 0.
n!
cn
= 0.
n n!
1 n
(7) lim 1 +
= e.
n
n
a n
(8) lim 1 +
= ea .
n
n
13.8
176
Sequences which are bounded, but not convergent can be very interesting. The study of chaos appears
in these sequences. A famous recursive sequence is the logistic sequence from population dynamics:
For certain values of the coefficient k, the behaviour is regular: convergent, or periodic. But other values
of k yield chaotic sequences which cannot be predicted. Figure 43 has some examples of the logistic
sequence when k = 2.9, 3.5 and 3.9.
Notes
177
Notes
178
14
14.1
179
Continuity
Definition: Continuity
y
y = f(x)
f(x)
approaches
f(a)
f(a)
a
as x approaches
x
a
Example
Let
f (x) =
x, x 6= 0
1, x = 0.
Then f (x) has a discontinuity at x = 0. This is because f (0) = 1 while lim f (x) = 0. Hence Condition
x0
180
y
14.1.2
Example
1
(see Figure 46) is not continuous at x = 0, since
x2
1/(x2)
5
f(x)
0
2
0
x
14.1.3
Example
f (x) =
x + 1, x 0
x2 , x < 0
14.2
181
If f is continuous on the closed interval [a, b], then f is continuous on (a, b) and
You could think of a continuous function being one that on an interval can be drawn without lifting your
pen.
14.2.1
Examples
14.3 Properties
14.3
182
Properties
14.3.1
If f is continuous at b and lim g(x) = b, then lim f (g(x)) = f (b). In other words,
xa
xa
14.3.2
14.4
183
Suppose that f is continuous on the closed interval [a, b] and let N be any number between f (a) and
f (b), where f (a) 6= f (b). Then there exists a number c (a, b) such that f (c) = N .
y
f(b)
N
f(a)
x
a
Figure 47: The IVT states that a continuous function takes on every intermediate value between the
function values f (a) and f (b). That is, we can choose any N between f (a) and f (b) which corresponds
to a value c between a and b. Note that this is not necessarily true if f is discontinuous.
14.4.1
Example
14.5
b) [1, 0]
c) [1, 1]
d) [0, 2]
e) [1, 3]
The bisection method is a procedure for approximating the zeros of a continuous function. It first cuts
the interval [a, b] in half (say, at a point c), and then decides in which of the smaller intervals ([a, c]
or [c, b]) the zero lies. This process is repeated until the interval is small enough to give a significant
approximation to the zero itself.
We can present this bisection method as an algorithm:
(1) Given [a, b] such that f (a)f (b) < 0, let c =
(2) If f (c) = 0 then quit; c is a zero of f .
a+b
.
2
184
f(b)
a
b
f(a)
or
or
We will investigate the bisection method in more detail in the lab sessions with MATLAB.
Notes
185
Notes
186
15.1 Tangents
15
187
Derivatives
Finding the instantaneous velocity of a moving object and other problems involving rates of change are
situations where derivatives can be used as a powerful tool. All rates of change can be interpreted as
slopes of appropriate tangents. Therefore we shall consider the tangent problem and how it leads to a
precise definition of the derivative.
15.1
Tangents
y
y=f(x)
B=(b, f(b))
f(b) f(a)
A=(a, f(a))
h
x
a
b=a+h
As the point B gets closer to A, m will become closer to the slope at the point A. To obtain this value,
we take the limit as h 0:
15.2
188
We say that f is differentiable at some point x if this limit exists. Further, we say that f is differentiable
on an open interval if it is differentiable at every point in the interval. Note that f 0 (a) is the slope of the
tangent line to the graph of y = f (x) at x = a.
We have thus defined a new function f 0 , called the derivative of f . Sometimes we use the Leibniz notation
dy
df
or
in place of f 0 (x).
dx
dx
Note that if f is differentiable at a, there holds:
f 0 (a) = lim
xa
15.2.1
f (x) f (a)
.
xa
Example
Using the definition of the derivative (i.e., calculating by first principles), find the derivative of f (x) =
x2 + x.
15.2.2
Example
15.2.3
189
15.3
190
If f is differentiable at a, then
The converse, however, is false. That is, if f is continuous at a, then it is not necessarily differentiable.
(See the following example.)
15.3.1
15.4
Example
Recall that the slope of the tangent line to y = f (x) at x = a measures the rate of change of y with
respect to x at the point x = a.
15.4.1
Example: Velocity
Similarly acceleration a is the rate at which velocity v changes with respect to time t, so
15.4.2
191
Example (blood flow in an artery) - Stewart, 7ed. p. 170 ex. 7; 6ed. p. 176 ex. 7
Blood flowing through a blood vessel can be described by the law of laminar flow. We model the
artery or vein as a cylinder. The closer the blood is to the artery wall, the slower it will flow due to
friction. Conversely, the velocity of the blood is greatest at the centre of the blood vessel (cylinder). In
mathematical terms, this law can be stated
v=
P
(R2 r2 ),
4l
where is the viscosity of the blood, P is the pressure difference between the ends of the artery, l is the
length of the blood vessel, R is the radius of the vessel and r is the distance from the centre of the vessel
(the only variable in this case); see Figure 50.
We now seek to find a general expression for the velocity gradient of the blood, that is, an expression for
the rate of change of velocity with respect to r:
Figure 50: The closer the blood is to the vein wall, the smaller its velocity.
This tells us at what rate the velocity of the blood decreases the further it is from the centre of the blood
vessel.
These types of problems are studied in later courses on fluid mechanics and other related topics.
15.5
192
Higher derivatives
Differentiating a function y = f (x) n times, if possible, gives the nth derivative of f , usually denoted
dn f
dn y
f (n) (x),
or
.
dxn
dxn
Therefore acceleration can be represented as
15.6
193
Suppose that f and g are differentiable functions, and let c be a constant. Then we have the following
rules:
In the Leibniz notation, if f and g are both differentiable functions, and c is a constant, then the rules
for differentiation can be expressed as:
15.6.1
Example
15.7
194
sin x
.
cos x
If g and h are both differentiable and f = g h is the composite function defined by f (x) = g(h(x)), then
f is differentiable and f 0 is given by the product
In the Leibniz notation, if y = g(u) and u = h(x) are both differentiable functions, then
15.7.1
Example
Differentiate y =
15.7.2
195
sin x.
A rocket is launched vertically and tracked by an observation station 5km from the launch pad. The
angle of elevation is observed to be increasing at 3 /s when = 60 . What is the velocity of the rocket
at that instant?
15.8
196
dy
we use
dx
x = f (f 1 (x)) = f (y).
Differentiating both sides with respect to x using the chain rule gives
15.8.1
Example
15.8.2
Example
15.8.3
197
15.9 LH
opitals rule - Stewart, 7ed. p. 470; 6ed. p. 472
15.9
198
LH
opitals rule - Stewart, 7ed. p. 470; 6ed. p. 472
Suppose that f and g are differentiable and g 0 (x) 6= 0 near a (except possibly at a). Suppose that
lim f (x) = 0 and lim g(x) = 0
xa
xa
or
lim f (x) = and lim g(x) = .
xa
Then
Example
Find lim
ln x
.
x1
x1
xa
15.9.2
199
Example
Find lim x ln x.
x0+
15.10
Sometimes LH
opitals rule can be used to evaluate limits of sequences. Let f be a function on the real
numbers such that lim f (x) exists. Let f (n) = an for natural numbers n. Then:
x
15.10.1
Example
ln n
.
n n
Evaluate lim
15.11
200
15.11.1
Example
15.12
Definition: Increasing/Decreasing
15.13
201
15.13.1
Example
15.14
15.14.1
202
15.14.2
203
Let f be a function defined on the interval [a, b], and c [a, b].
Then f has a global maximum at c if
15.14.3
Example
15.14.4
Theorem
15.15
Let f be continuous on [a, b] and differentiable on (a, b), and let c (a, b).
(a) If f 0 (x) > 0 for a < x < c and f 0 (x) < 0 for c < x < b
(b) If f 0 (x) < 0 for a < x < c and f 0 (x) > 0 for c < x < b
Proof:
204
15.16
205
(c) If f 0 (c) = 0 and f 00 (c) = 0, then the test fails and we get no useful information. In this case the first
derivative test should be used.
15.16.1
Example
15.16.2
Example
206
15.16.3
207
In a beehive, each cell is a regular hexagonal prism, open at one end with a trihedral angle at the other
end (see Figure 52). It is believed that bees form their cells in such a way as to minimise the surface area
for a given volume, thus using the least amount of wax in cell construction. Examination of these cells
has shown that the measure of the apex angle is amazingly consistent. Based on the geometry of the
cell, it can be shown that the surface area S is given by
S() = 6sh +
3s2
( 3 cos )
2 sin
where s, the length of the sides of the hexagon, and h, the height, are constants.
Figure 52: The beehive cell. The open front is pictured on the bottom and the closed end with the
trihedral angle on top.
(a) Calculate
dS
d
208
15.17
15.17.1
Find the global maximum and minimum of the function f (x) = x3 3x2 + 1 on the interval [ 12 , 4].
209
15.18
15.18.1
210
Optimization problems
Example: Optimal rowing
A rowing team launches a boat from point A on a bank of a straight river 3km wide, and wants to reach
point B, 8km downstream on the opposite bank as quickly as possible; see Figure 53. They could row
their boat directly across the river to a point C and then run to B, or they could row directly to B, or
they could row to some point D between C and B and then run to B. If they can row 6km/h and run
8km/h, where should they land to reach B as soon as possible? (Assume that the speed of the water is
negligible compared to the speed at which they row.)
8km
C
3km
Figure 53: How should the team travel from A to B in the shortest possible time?
211
15.18.2
212
Some farmers have a certain amount of fencing to build a rectangular enclosure which is to be subdivided
into 3 parts by 2 fences parallel to one of the sides. How should they do it so the area enclosed is
maximised?
15.18.3
213
Newtons method is a numerical procedure to approximate the roots of functions. Most programs which
find roots of functions are based on this method. For example, consider the equation
tan x = x
How would you find the roots of this equation? It is impossible to solve analytically (ie, precisely), but
Newtons method gives us a way of approximating the roots to some degree of accuracy.
The idea behind the geometry of this method is given in Figure 54. We must have a starting guess (the
value x1 ), then we find the tangent line to the curve at that point, and find where the tangent line cuts
the x-axis. This gives us the next point. We repeat the process until we have a close enough estimate.
x2
x1
Figure 54: Starting at x1 , this gives you an idea of how Newtons method iterates to estimate the root p.
Mathematically, the slope of the tangent line to the curve at the point (x1 , f (x1 )) is given by
f 0 (x1 ) =
f (x1 ) 0
x1 x2
x2 = x1
f (x1 )
.
f 0 (x1 )
If the numbers xn become closer and closer to p as n becomes large, we say the sequence converges to p.
This method is very sensitive to the type of curve and the choice of starting point.
We will investigate Newtons method in more detail in the lab sessions using MATLAB.
Notes
214
Notes
215
Notes
216
16.2 Motivation
16
16.1
217
Series
Infinite sums (notation)
an .
n=0
16.2
Motivation
16.3
218
Given a series
n=0
an is said to be
n=0
an = s.
n=0
The number s is called the sum of the series. Otherwise the series is said to be divergent.
16.3.1
Example
n=0
16.3.2
219
Example
X
n=0
16.4
1
is convergent.
(n + 1)(n + 2)
Theorem: p test
X
1
is
np
n=1
Note the above sum is from n = 1. This is just a matter of taste since
X
X
1
1
=
p
n
(n + 1)p
n=1
n=0
16.5
16.6
16.6.1
Examples
(1)n
n=0
(ii)
X
n=1
n2
5n2 + 4
220
16.6.2
221
Caution
For example,
1
=0
n n
lim
X
1
1 1 1
= 1 + + + + ...
n
2 3 4
n=1
16.7
s2 = 1 +
s3
s4
s8
1 1 1
1 1 1 1
= 1+ + + +
+ + +
2 3 4
5 6 7 8
1 1 1
1 1 1 1
1+ + + +
+ + +
2 4 4
8 8 8 8
1
1
1
= 1+ +
+
.
2
2
2
16.8
The series
arn
n=0
X
n=0
arn =
a
and divergent if |r| 1.
1r
16.8.1
Proof
222
16.9 Application: Bouncing ball - Stewart, 7ed. p. 736 qn 72; 6ed. p. 731 qn 58
16.8.2
223
Intuition
If all the terms in the series stay large, then the series is divergent. If the individual terms are becoming
smaller then the series may converge, but not necessarily.
16.9
A certain ball has the property that each time it falls from a height h onto a hard, level surface, it
rebounds to a height rh, where 0 < r < 1. Suppose that the ball is dropped from an initial height of H
metres.
(a) Find the total distance that the ball travels.
16.9 Application: Bouncing ball - Stewart, 7ed. p. 736 qn 72; 6ed. p. 731 qn 58
224
(b) Calculate the total time that the ball travels. Use the fact that the ball falls gt2 /2 metres in t seconds
(from classical physics).
16.10
225
Comparison tests
n=0
then it may be possible to bound the series by using simpler terms. If |an | is always smaller than |bn |
X
X
and
|bn | converges, then
an should also. On the other hand, if an is always large - in fact larger
n=0
n=0
bn diverges, then
n=0
16.11
n=0
Suppose that
an and
n=0
16.11.1
n=0
Example
X
ln n
n=1
for convergence.
16.11.2
Example
X
n=0
16.12
226
5
for convergence.
2 + 3n
Alternating series
The tests for convergence have so far required terms to be positive. However, if terms alternate in sign
+, , +, , . . . (or , +, , +, . . .) there are some special results. We call such a series an alternating
series.
Here is quite an interesting result:
We have seen that the harmonic series
1+
1 1 1
+ + + ...
2 3 4
16.13 Theorem: Alternating series test - Stewart, 7ed. p. 751; 6ed. p. 746
16.13
n=0
satisfies
Example
(1)n
n=0
1
n+1
227
16.13 Theorem: Alternating series test - Stewart, 7ed. p. 751; 6ed. p. 746
16.13.2
Example
(1)n
n=1
3n
4n 1
228
16.14
16.14.1
229
Examples
(i)
(1)n
n=1
1
n
230
(ii)
(1)n
n=1
(iii)
1
n4
X
cos n
n=1
n2
16.14.2
231
16.15
Proof
A powerful test for convergence of series is the ratio test. We will use it extensively in the following
sections.
X
an+1
= L < 1, then the series
1. If lim
an is absolutely convergent (and therefore convergent).
n
an
n=1
X
an+1
an+1
2. If lim
= L > 1 or lim
= , then the series
an is divergent.
n
n
an
an
n=1
an+1
= 1, then the ratio test is inconclusive.
3. If lim
n
an
an+1
is not defined, then the ratio test is inconclusive.
4. If lim
n
an
Note that the ratio test only tests for absolute convergence. The ratio test does not give any estimates
of the sum.
16.15.1
232
Examples
Use the ratio test to determine, if possible, whether the following series are absolutely convergent.
X
(i)
arn
n=0
(ii)
(1)n
n=1
n3
3n
Notes
233
17
17.1
234
Such series have many applications, for example, solutions of higher order O.D.Es (ordinary differential
equations) with non-constant coefficients, which in turn are very important to many areas of science and
engineering.
17.1.1
Example
Use the ratio test to determine for which values of x the following series converges:
X
(x 3)n
n=1
17.1.2
235
Use the ratio test to determine for which values of x the Bessel function of order zero (denoted J0 (x))
converges, where
X
(1)n x2n
J0 (x) =
.
22n (n!)2
n=0
Bessel functions first arose when Bessel solved Keplers equation for describing planetary motion. Since
then, they have been used in applications such as temperature distribution on a circular plate and the
shape of a vibrating membrane (such as the human ear).
The graph of J0 (t) is given in Figure 56.
besselj(0,t)
1.5
0.5
0.5
1
0
10
15
t
20
25
30
17.2 Theorem: Defines radius of convergence - Stewart, 7ed. p. 767; 6ed. p. 761
17.2
236
n=0
In case (1), we say that the radius of convergence is 0, while in case (2) we say that the radius of
convergence is .
The interval of convergence of a power series is the interval that consists of all values of x for which the
series converges. In case (1) the interval is a single point, a. In case (2) the interval is (, ). In case
(3) the interval is either (a r, a + r), (a r, a + r], [a r, a + r) or [a r, a + r].
17.2.1
237
Example
X
(3)n xn
converge?
17.3
Taylor series
n=0
How do we find the coefficients cn in general? Let us assume that f and all its derivatives are defined at
x = a.
First note that
f (a) = c0 .
Now take the derivative of both sides. Assuming that we are justified in differentiating term by term on
the right-hand side, this gives
238
so that
f 0 (a) = c1 .
Taking the derivative again and again gives
f 00 (a) = 2c2
c2 = f 00 (a)/2
c3 = f 000 (a)/3!
and, in general
cn = f (n) (a)/n!, with f (0) (x) f (x).
This leads to
The right-hand side is called the Taylor series of f (x) about x = a. So this result says that if f (x) has
a power series representation (expansion) at x = a, it must be given by the formula above.
17.3.1
Note
The function f and all its derivatives must be defined at x = a for the series to exist. In this case we say
that f is infinitely differentiable at x = a.
17.4
X
f (n) (a)
n=0
n!
Unless otherwise noted, all functions we consider in this section are sufficiently well behaved.)
239
k
X
f (n) (a)
n=0
n!
(x a)n
which is a useful polynomial approximation. The smaller |x a|, the better the approximation. This
approximation can be made accurate to arbitrary order by taking k sufficiently large provided |x a| < r.
This begins to address the question of whether or not f (x) has a power series representation. The details
are beyond the scope of this course, but for those interested there is a good discussion about this issue
and Taylors inequality in Stewart, 7ed. pp. 778-780; 6ed. pp. 772-774.
17.4.1
Example
Find the Taylor series of f (x) = ln x about x = 1. Determine its radius of convergence.
240
17.4.2
Example
Find the Taylor series of f (x) = ex about x = a. Determine its radius of convergence.
241
17.4.3
Example
Find the MacLaurin series for f (x) = sin x. Determine its radius of convergence.
242
17.5
243
Binomial series
(1 + x)
m
X
m n
=
x ,
n
n=0
m
where
are the binomial coefficients defined by
n
m
m
m(m 1) . . . (m n + 1)
= 1,
=
0
n
n!
for n = 1, 2, ....
Note that in this expression for the binomial coefficient, m can be any real number. In the case that m is
a positive integer and 0 n m, such as in the above expansion, it can be written in the more familiar
form
m
m!
=
.
n
(m n)!n!
Also note that when both m and n are positive integers, with n m + 1 the binomial coefficient is zero.
The above expansion can then be written
(1 + x)
X
m
n=0
xn .
244
Generalize the binomial theorem to arbitrary real powers by finding the MacLaurin series expansion of
the function f (x) = (1 + x) where R. Find also the radius of convergence of the series.
17.5.1
245
|x| < 1.
for
This result follows from the binomial theorem. Taking = 1 and replacing x with x we have
f (x) = (1 x)1 =
1
.
1x
1
(1)(2) . . . (n)
=
= (1)n ,
n!
n
for
n=1
n=0
X
X
1
=1+
(1)n (x)n =
xn ,
1x
which is the geometric series.
n 1.
Notes
246
Notes
247
18
18.1
248
Integration
Definition: antiderivative - Stewart, 7ed. p. 269; 6ed. p. 274
See the table below for some examples of antiderivatives. We use the notation F 0 = f , G0 = g and c is a
constant.
Function
Antiderivative
Function Antiderivative
cf (x)
cF (x)
cos x
sin x
f (x) + g(x)
F (x) + G(x)
sec2 x
tan x
x , ( 6= 1)
x+1
+1
1
x
ln x
sin x
cos x
ex
ex
The most general antiderivative can be obtained from those given in the table by adding a constant. Notice
d
d
that if
F (x) = f (x) then
(F (x) + C) = f (x) is also true where C is any constant (independent of
dx
dx
x).
18.1.1
Example
18.3 Area under a curve - Stewart, 7ed. pp. 284-291; 6ed. pp. 289-296
18.1.2
Example
If f 00 (x) = x
18.2
249
x, find f (x).
whereRF (x) is any antiderivative of f (x) and c is an arbitrary constant called the constant of integration.
Thus f (x)dx gives all the antiderivatives of f (x).
18.3
Area under a curve - Stewart, 7ed. pp. 284-291; 6ed. pp. 289-296
Consider the problem of finding the area under a curve given by the graph of a continuous, non-negative
function y = f (x) between two points x = a and x = b; see Figure 57.
y=f(x)
Figure 57: We need to define the area of the region S = {(x, y)|a x b, 0 y f (x)}.
18.3 Area under a curve - Stewart, 7ed. pp. 284-291; 6ed. pp. 289-296
250
Although we might have an intuitive notion of what we mean by area, how do we define the area under
such a curve?
We start by subdividing S into n strips S1 , S2 , . . . , Sn of equal width. The width of the interval [a, b] is
b a so the width of each strip is
y=f(x)
a c1
c2
c3
c4
c5
c6
Now what happens if we increase n? Consider the graph in Figure 59. It seems that as x becomes
smaller (when n becomes larger), the approximation gets better.
Therefore we define the area A of the region S as follows.
18.3 Area under a curve - Stewart, 7ed. pp. 284-291; 6ed. pp. 289-296
251
y=f(x)
Figure 59: The smaller the width of the rectangle, the better the approximation, in general. Notice that
in this diagram we chose ci = a + ix.
18.3.1
The area A of the region S that lies under the graph of the continuous, non-negative function f is
It can be shown that for continuous f , this limit always exists and is independent of the choice of ci .
This can be proved using the fact that f is continuous on [a, b]. This sum Rn is called a Riemann sum.
Note that lim [f (c1 )x + + f (cn )x] is called the Riemann integral of f on [a, b] and is denoted
n
Rb
f (x)dx.
IMPORTANT: this definition can be carried over to functions which are not necessarily non-negative.
The intuitive interpretation of A as an area is then no longer valid. The quantity A should then be
viewed as a signed area, i.e.
A = (area above x-axis, below graph) (area below x-axis, above graph).
Stewart, 7ed. p. 297; 6ed. p. 301.
18.4
18.4.1
252
f (t) dt
a
gives an antiderivative of f (x) such that A(a) = 0. Since A(x) is an antiderivative of f , A0 = f . Thus
Z x
d
f (t) dt = f (x)
dx a
(b) If F (x) is any antiderivative of f (x), then
Zb
F (b) F (a) =
f (t) dt.
a
18.4.2
Proof (outline)
18.4.3
253
Notation
We will write
b h
ib
F (x) = F (x) = F (b) F (a).
a
18.4.4
Z
f (x) dx =
f (x) dx
a
c dx = c(b a)
Z
[f (x) g(x)] dx =
Z
f (x) dx +
f (x) dx =
c
f (x) dx
a
f (x) dx = 0
a
18.4.5
g(x) dx
a
f (x) dx
f (x) dx
cf (x) dx = c
Examples
Z
(1) Evaluate
1
1
dt.
t
/2
(2) Evaluate
sin xdx.
0
Zu
(3) If F (u) =
2
dt
, find F 0 (u).
1 + t2
sin
Z x
(4) If G(x) =
2
dt
, find G0 (x).
1 + t2
254
18.4.6
255
Example
Find the area between the x-axis and the curve y = sin x on [0, ].
18.4.7
Example
Find the area bounded by the curves y = x2 and y = x3 on the interval [0, 1].
18.4.8
Corollary
f (x)dx 0.
a
18.4.9
256
Example
18.5
We can approximate the area under a curve by taking the sum of a finite number of rectangles under the
graph as outlined in the previous section. If we choose the ci to be the left endpoints of each rectangle,
we obtain the approximation
n
X
`n =
f (xi1 )x.
i=1
If we choose the ci to be the right endpoints of each rectangle we obtain the approximation
rn =
n
X
i=1
f (xi )x.
18.6 Improper integrals - Stewart, 7ed. pp. 543-551; 6ed. pp. 544-551
257
The trapezoidal rule is the approximation of the area under a curve which takes the average value of `n
and rn .
The formula for this approximation is therefore given by
18.6
Definition
18.6 Improper integrals - Stewart, 7ed. pp. 543-551; 6ed. pp. 544-551
18.6.1
Z
Find
f (x)dx are called convergent if the limit exists and divergent otherwise.
f (x)dx and
The integrals
258
Example
ex dx.
18.6.2
Note
It is still possible to define the integral for some classes of functions which are not necessarily continuous:
Stewart, 7ed. p. 548; 6ed. p. 548. Note also that there are other types of improper integral: Stewart,
7ed. p. 547; 6ed. p. 547.
18.7
18.7.1
Substitution
18.7.2
Z
Find
259
18.7.3
Evaluate
1
18.7.4
dx
.
(5x 3)2
Evaluate
dx
.
x2
a2
260
18.7.5
Example
Z
Evaluate
18.7.6
Example
Z
Evaluate
261
18.7.7
262
Integration by parts
Given two differentiable functions u(x) and v(x) we have a product rule for differentiation:
Example
Z
Evaluate
x3 ln xdx.
uv 0 dx.
18.7.9
Example
Z
Evaluate
xex dx.
18.7.10
General rule
R
For (polynomial) eax+b dx, choose u to be the polynomial and v 0 = eax+b .
R
For (polynomial) ln (ax + b)dx, choose u = ln (ax + b) and v 0 to be the polynomial.
Note that sometimes integration by parts needs to be applied more than once.
18.7.11
Example
Z
Evaluate
x sin xdx.
263
264
18.8
18.9
P (x)
Q(x)
is called a rational function. Integration of a rational function is made possible by expressing it as the
sum of simpler fractions, called partial fractions.
(In the three examples which follow, we will only consider rational functions for which the degree of P (x)
is less than the degree of Q(x).)
The general process for obtaining the sum of partial fractions is as follows:
Factor the denominator Q(x) as much as possible;
A
Ax + B
or
,
i
2
(ax + b)
(ax + bx + c)j
where the denominators of these fractions come from the factorisation of Q(x).
Express f (x) as a sum of fractions each of which take either the form
Example
Z
Evaluate
x+2
dx.
x2 + x
265
18.9.2
Example
Z
Evaluate
x2
dx
, a 6= 0.
a2
266
18.9.3
Example
Z
Evaluate
2x2 x + 4
dx.
x3 + 4x
267
268
18.10
269
Volumes of revolution
Suppose f (x) is positive and continuous on [a, b]. By rotating the graph of f (x) above [a, b] about the
x-axis, we obtain a cylindrical solid. What is the volume of such a solid? This is what we call a volume
of revolution.
y=f(x)
y=f(x)
(a)
(b)
Figure 60: Rotating the curve in (a) about the x-axis gives the solid in (b).
18.10.1
Suppose f (x) 0 and continuous on [a, b]. The volume of revolution of the solid obtained by rotating
the graph y = f (x) above [a, b] about the x-axis is
18.10.2
Outline of proof
For x [a, b], let V (x) be the volume obtained by rotating the graph of f above the interval [a, x] about
the x-axis. So V (a) = 0, V (b) = V . Then for h 0 small
V (x + h) V (x) =
V (x + h) V (x)
' [f (x)]2
h
270
18.10.3
Example
Let a > 0. Find the volume of the solid obtained by rotating y = f (x) =
18.10.4
Example
Determine the volume of the solid obtained by rotating y = x about the x-axis over [0, 1].
18.10.5
271
Example
Determine the volume of the solid obtained by rotating y = x2 about the x-axis over [0, 1].
18.10.6
Example
The region enclosed by the curves y = x and y = x2 is rotated about the x-axis. Find the volume of the
resultant solid.
Notes
272
19.2 Functions
19
273
You should attempt the practice problems in this section while learning the material in the course. Try to
solve all questions. Do at least questions marked with a star (*) before attempting assignment questions.
Have a look at the questions before your tutorial. Try to solve them yourself first, and ask your tutor at
the tutorial if you need help. Solutions to questions on this sheet are not to be handed in.
19.1
Numbers
1. Solve for x.
(a) |x + 1| < 1
(b) |x + 1| > 1
(c) |3x + 5| 2
2. Simplify.
(a)
(b)
3+i
3i
(2+3i)(3+2i)
1+i
3. Write z = 1
3i in polar form.
19.2
Functions
1. Graph the following functions and give their domain and range.
(a) f (x) = x2 + 2
(b)
f (x) =
(c)
f (x) =
(d) f (x) =
(e)
f (x) =
(f)
f (x) =
1
x2
1
x2
1
x2 +2
x+2
x2 4
x2 9
(g) f (x) = x2 + 9
19.3 Limits
274
|x|
.
x2
(
2x + 3,
f (x) =
3 x,
x < 1
x > 1
1
3
19.3
(b) f (x) =
x+1
x+2 .
Limits
1. Let
f (x) =
x3
x2 9
2x+1
2. Prove that lim x4 cos 3x
2 +5 = 0.
x0
19.4 Continuity
275
x2 +2x8
2
x2 x 5x+6
(a) lim
x2 x12
x+3
x1
(b) lim
x+1
2
x1 x x2
(c) lim
t3 t
2
t
t1 1
2
lim x+2
x
x0
(d) lim
(e)
4. Show
lim
x3
x+2+
2).
x
3
=
5
5
1
lim x sin( ) = 0.
x0
x
(a) lim
(b) lim ( x + 1 x)
x
x2 1
3
x
x +2
(c) lim
xx3
2
x x +1
lim x+1 .
x 1x
(d) lim
(e)
19.4
Continuity
1. Determine whether or not f (x) is continuous at x = 1 and sketch the graph of f (x) for the following
choices of f (x):
2
x 2x + 2 , if x < 1
(a) f (x) =
3x
, if x 1
x3
, if x < 1
(b) f (x) =
(x 2)2 , if x 1
x1
, if x 6= 1
x2 1
(c) f (x) =
6
, if x = 1.
19.5 Derivatives
19.5
276
Derivatives
d
dx
sinh x = cosh x,
d
dx
cosh x = sinh x.
lim sinh x .
x0 x
3. The Tasmanian Devil often preys on animals larger than itself. Researchers have identified the
mathematical relationship
L(w) = 2.265w2.543 ,
where w (in kg) is the weight and L(w) (in mm) is the length of the Tasmanian Devil. Suppose
that the weight of a particular Tasmanian Devil can be estimated by the function
w(t) = 0.125 + 0.18t,
where w(t) is the weight (in kg) and t is the age, in weeks, of a Tasmanian Devil that is less than
one year old. How fast is the length of a 30-week-old Tasmanian Devil changing?
4. Show that the equation of the tangent line to a point (x0 , y0 ) on the ellipse
x2
a2
+ yb2 = 1 is given by
x0 x y0 y
+ 2 = 1.
a2
b
dC
dt
(b) How much will the car be worth in the long run?
7. Find
d
.
d cos(sin )
8. A spherical snowball is melting in such a way that its volume is decreasing at a rate of 1 cm3 /min.
At what rate is the diameter decreasing when the diameter is 10 cm?
9. Using LH
opitals rule evaluate the following limits
(a)
lim
ex 1
x0 sin x
lim sinxxx
3
x0
1
lim ( 1 x1
)
x1 ln x
(b) lim
(c)
(d)
1cos
2
19.6 Integration
277
(e) lim ex ln x
x
(sin )n
n ,
0 sin( )
(f) lim
1 n N.
10. Use the mean value theorem to prove the following (this is the second derivative test).
Suppose f : [a, b] R is continuous, and has continuous first and second derivatives on [a, b]. Then
if c (a, b) is a point with f 0 (c) = 0 and f 00 (c) > 0 then f has a local minimum at c.
11. Determine where the following functions are increasing/decreasing.
(a) f (x) = (x 1)(x + 2) = x2 + x 2
(b) f (x) = x|x|.
(c) f (x) = sin x, x (0, )
(d) f (x) =
ex +1
ex
f (x) =
1
.
x
x ln x , x > 0
0
, x=0
is continuous on [0, ). What are the absolute maximum and minimum values of f (x) on [0, 2]?
17. To increase the velocity of the air flowing through the trachea when a human coughs, the body
contracts the windpipe, producing a more effective cough. Tuchinsky formulated that the velocity
of air that is flowing through the trachea during a cough is
V = C(R0 R)R2 ,
where C > 0 is a constant based on individual body characteristics, R0 is the radius of the windpipe
before the cough, and R is the radius of the windpipe during the cough. Find the value of R that
maximizes the velocity. (Interestingly, Tuchinsky also states that X-rays indicate that the body
naturally contracts the windpipe to this radius during a cough.)
19.6
Integration
1. Evaluate
R
(a) (x3 2x + 1)dx
R
(b) xa dx, a > 0.
R
(c) sin(x + 3 + 2x)dx
R
(d) (x + x1 )2 dx
19.6 Integration
278
y = f(x)
1
1
3
1
1 3 1 1
2 dx = (x 1) = 2 1 = 2 .
(x 1)
0
5. Find the area enclosed by the graphs of the functions f (x) = x2 and g(x) = x.
6. Derive a formula for the area of the ellipse
x2 y 2
+ 2 = 1.
a2
b
7. Find the area under the graph of
(b)
9. Determine
R0
(1 +
9 x2 )dx
(c)
R2
2
|x|dx
(d)
R2
4 x2 dx.
xex dx.
19.7 Sequences
(b)
(c)
279
dx
dx
x2 +4x+9
3
x2
a2
y2
b2
16. Let a > 0 be constant. Find the volume V of the solid of revolution obtained by rotating y = f (x)
above the interval [0, a] about the x-axis, for the following choices of f (x):
(a) y = x2
p
(b) y = ln(x + 1).
17. Use Eulers formula to express cos(2) and sin(2) in terms of cos() and sin().
19.7
Sequences
1. Use LH
opitals rule to find
lim
sin(1/n)
.
log(1 + 1/n)
(b) an =
1+2n
1+3n .
3. Prove that
lim n1/n = 1.
19.8 Series
19.8
280
Series
1. It is known that a repeated decimal can always be expressed as a fraction. Consider, for example,
the decimal 0.727272 . . . . Use the fact that
0.727272 = 0.72 + 0.0072 + 0.000072 + . . .
to express the decimal as a geometric series. Hence show that
0.727272 =
8
.
11
(b)
n=1
1
1
12 + 23
nn
n!
1
34
+ ...
nxn =
n=1
x
,
(1x)2
1
d
( 1x
))
(Hint: Consider x dx
P
n=1
n
2n .
X
1
1
1 1
1 1 1 1
1
1
1
=1+( )+( + )+( + + + )+( +
+ + ) + ...
n
2
3 4
5 6 7 8
9 10
16
n=1
and group together its terms as shown. Show that the sum of each group of fractions is more than
1
2 . Hence deduce that the harmonic series diverges.
(b)
n=1
( 1n
1 )
n+1
(1)n xn .
n=0
X
1
np
n=1
diverges for 0 p 1.
7. Determine whether or not the following series converge.
(a)
(b)
n=1
(c)
n=0
P
n=1
(1)n
n3n
22n
(2n)!
ln(n)
n! .
281
8. (a) Write
P down from the examples in lectures or the text book two series of positive terms
&
bn satisfying the following conditions:
X
an+1
= 1 and the
lim
an converges.
n
an
m
X
bn+1
= 1 and
lim
bn diverges.
n
bn
an
This shows the ratio test gives no information if the limit is 1. You can accept any proofs of
convergence in lectures or the text book but prove both the limits above.
9. Find an example of a sequence an with an = f (n)/g(n) for differentiable functions f and g, where
limn an and limn f 0 (n)/g 0 (n) both exist, and
f 0 (n)
.
n g 0 (n)
lim an 6= lim
19.9
n=0
(1)n
.
(2n + 1)3n
3. Obtain the MacLaurin series expansions and radius of convergence for the following functions:
1
cosh x = (ex + ex )
2
n=0 an ,
2. Obtain the MacLaurin series expansion for arctan x and its radius of convergence.
1
d
(arctan x) = 1+x
(Hint: Use dx
2 ).
X
=2 3
1
sinh x = (ex ex ).
2
1+x=1+
X
(1)n1 (2n 2)!
n=1
xn .
(b)
X (1)n (2n)!
1
=
xn .
1 + x n=1 22n (n!)2
5. The theory of relativity predicts that the mass m of an object when it is moving at a speed v is
given by the formula
m0
m= p
1 v 2 /c2
where c is the speed of light and m0 is the mass of the object when it is at rest. Express m as
a MacLaurin series in vc and determine for which values of v this series converges. (Hint: Use a
result from the previous question.)
19.10 Vectors
282
7. Find the sum of each of the following convergent series by recognizing it as a Taylor series evaluated
at a particular value of x.
(a) 1 +
(b) 1
(c) 1 +
(d) 1
19.10
2
4
8
2n
1! + 2! + 3! + + n! + . . .
(1)n
1
1
1
3! + 5! 7! + + (2n+1)! + . . .
1
1 2
1 3
1 n
4 + (4) + (4) + + (4) + . . .
(1)n 102n
100
10000
+ ...
2! + 4! + +
(2n)!
Vectors
1. A canoe travels at a speed 3km/h in a direction due west across a river flowing due north at 4km/h.
Find the actual speed and direction of the canoe.
2. Draw a clock with vectors v 1 , v 2 , . . . , v 12 pointing from the centre to each of 1, 2, . . . , 12. Describe
each of the following vectors.
(a) v 1 + + v 12 .
(b) v 1 + v 2 + 3v 3 + v 4 + v 5 + v 6 + v 7 + v 8 + 3v 9 + v 10 + v 11 + v 12 .
(c) v 1 + v 2 + v 3 + v 4 + v 6 + v 7 + v 9 + v 10 + v 12 .
3. Find the lengths of the sides of the triangle ABC and determine whether the triangle is a right
triangle.
(a) A = (4, 2, 0), B = (6, 6, 8), C = (10, 8, 6)
(b) A = (5, 5, 1), B = (6, 3, 2), C = (1, 4, 4).
4. (a) Suppose u and v are orthogonal vectors. Prove that
kuk2 + kvk2 = ku + vk2 . What geometric fact have you proved?
(b) Prove that ku + vk2 + ku vk2 = 2(kuk2 + kvk2 ). What geometric fact have you proved?
(c) Consider a triangle with side lengths a, b, c. Bisect side c, and draw a line connecting the
midpoint to the opposite vertex. Let the length of this line be m. Using vectors prove that
a2 + b2 = 2(m2 + (c/2)2 ). This is called Apollonius Theorem.
1
4
5. Find a non-zero vector in R3 orthogonal to 2 and 5 .
3
6
6. Given the point P = (2, 1, 4), find a point Q where P Q has the same direction as v = 7i+6j 3k.
7. For what values of c is the angle between the vectors (1, 2, 1) and (1, 1, c) equal to 60 ? For what
values of c are they orthogonal?
8. Determine whether or not each of the following sets of vectors are linearly independent.
1
1
1
(a) 2 , 1 , 2 .
0
1
1
283
(b) i + j, i + j + k, i j.
1
1
1
0 2 2
(c)
0 , 0 , 1 ,
0
0
0
9. Prove that the vectors
4
4
.
1
0
1
1
1
0 , 0 , 1
1
1
0
2
form a basis for R3 . What are the components of the vector 1 in this basis?
0
10. Given
1
2
2
v 1 = 5 , v 2 = 1 , v 3 = 9 ,
3
6
h
for what values of h is v 3 in span{v 1 , v 2 }, and for what values of h is {v 1 , v 2 , v 3 } linearly independent? Justify your answer.
11. Which of the following subsets of R3 are vector spaces? Find a basis in each case.
(a) {(a, b, a + 2b) | a, b R}.
(b) {(a, b, c)|a b = 3c + 1}.
12. Suppose S = {v 1 , v 2 , . . . , v m } Rn and let V be the set of all linear combinations of the elements
of S, so
V = {1 v 1 + 2 v 2 + + m v m | 1 , 2 , . . . , m R}.
Prove that V is a vector space.
13. If {a, b, c} forms a basis for a 3-dimensional vector space, could {a + b, b + c, c + a} also be a basis?
Give your reasons.
14. Let u1 = (0, 0, 3), u2 = (2, 1, 0), u3 = (1, 0, 0). Which of u1 , u2 , u3 are linear combinations of
v 1 = (1, 2, 3), v 2 = (4, 5, 6), v 3 = (7, 8, 9)? Do {v 1 , v 2 , v 3 } form a basis of R3 ?
15. Determine if the following vectors are a basis for R3 . Justify your answer.
0
5
6
1 , 7 , 3
2
4
5
16. Let v 1 = (1, 2, 3), v 2 = (4, 5, 6), v 3 = (2, 1, 0). Do {v 1 , v 2 , v 3 } form a basis of R3 ? Explain.
17. Let v 1 = (1, 4, 6), v 2 = (2, 0, 1), v 3 = (1, 12, 16). Let V = span{v 1 , v 2 , v 3 }. Find dim V .
19.11
Matrix Algebra
cos sin
1. Let A =
sin cos
4. Let A =
284
1 2
3 4
. Find all 2 2 matrices B such that AB = BA.
2/3 0 x
A = 0 1 0
2
0 1/3
3
(b) What is the smallest (integer) index N so that B N = 0? A matrix with such a property is
called nilpotent.
0 1 0 0
0 0 2 1
B=
0 0 0 1 .
0 0 0 0
1 2
1
2 . Show that C is invertible, ie show linear independence of a certain set of
7. Let C = 1 1
1 3 1
vectors.
4 -1 2
8. Let A = 3 0 x . For which value(s) of x is A not invertible?
8 -3 2
9. Find the inverse matrix for:
1 0
(a)
0 1
1 2
(b)
3 4
1 2 3
(c) 0 1 2
0 0 1
10. Let
A=
1
5
3
5
2
5
1
5
3
5
2
5
1
5
1 2 x
and B = 3 1 y .
0
0 z
12. Use Gaussian elimination to solve the following system of equations, and check your answer by
substitution.
x1 2x2 + 3x3 = 6
4x1 + 2x3 = 2
3x1 + x2 + 2x3 = 3
285
13. Let xp be a particular solution of Ax = b. Show that every solution of this equation is of the form
x = xp + h where h is a solution of the homogeneous equation Ax = 0.
14. Show that the set of solutions of
Ax = b, with b = 0
form a vector space for A.
If b 6= 0, does the set of solutions still form a vector space?
2 1
15. Show that A =
satisfies A2 4A + 3I = 0. Hence deduce that A is invertible with inverse
1 2
A1 = 31 (4I A).
16. Let a R. Use Gauss-Jordan elimination to find the inverses of the following matrices. Check by
multiplication if your inverse is correct.
1 1
0
(a) 1 2
2 1 1
0 0 1
(b) 1 2 1 .
1 0
17. Find the inverses of the following matrices.
1 1 1
(a) 1 2 1 .
2 1 1
1 2 3 1
1 3 3 2
(b)
2 4 3 3 .
1 1 1 1
1 1
.
(c)
1 2
1 0 5
18. Let A = 2 -1 2 . Calculate the determinant of A.
3 1 2
19. Determine for which values of x the following determinants vanish:
1x
2
(a)
3
2x
1 2
(b) 2
x x
1 1 4
(c) 2
x 1 .
2x x2 x
20. Evaluate the following determinants
cos sin
(a)
sin cos
3 1 0
(b) 0 6 4
0 0 1
(c)
(d)
1 3
4
2 4 1
3 1
0
1 1 5
1 1 2
2 1 1
1 1 1
1
3
0
4
21. Use determinants to establish the linear dependence or independence of the following row vectors:
(a) (4, 1, 4), (2, 0, 4), (1, 2, 2)
(b) (3, 3, 1), (6, 6, 0), (3, 3, 2)
(c) (1, 1, 1), (0, 1, 0), (0, 1, 1)
286
22. For an invertible matrix A, prove that An is also invertible, for all natural numbers n.
20
20
287
>
<
,
{x|...}
...
n!
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
e.g.
5>2
2<5
2 2, 4 3
3.5 R
3.5
/N
NR
{x R|x > 0}
x R
1, 2, 3, ..., 9, 10
3! = 3 2 1 = 6
x = 2 x2 = 4
x2 = 4 x = 2 or x = 2
21.1 Powers
21
288
Appendix - Basics
This appendix contains some very important basic mathematical rules. Since this is highschool material,
you must know and be able to apply all of them to successfully complete MATH1051. Go through
the sections and check your knowledge - do some additional exercises from textbooks if you encounter
problems, or check the MATH1040/MATH1050 material on the course websites.
21.1
21.1.1
Powers
Notation (product of two real numbers)
The product of two real numbers a and b can be written in either of the following ways:
a b = a b = ab.
21.1.2
Notation (powers)
Power rules
Let a, b, c R. We set
ab =
1
.
ab
Then
ab ac = ab+c , a > 0 and
c
ab = abc .
We also have
aq =
ap ,
Examples
1. (a a) (a a) (a a) = a2
2. a2 a3 = a2+3 = a5
1
3. a 2 = a
1
4. a 3 = 3 a
3
= a23 = a6
21.3 Fractions
21.2
289
21.2.1
1. a + b = b + a and ab = ba
(Commutative Law)
(Associative Law)
3. a(c + d) = ac + ad = (c + d)a = ca + da
21.2.2
(Distributive Law)
1. (a + b)(c + d) = ac + ad + bc + bd,
as (a + b)(c + d) = a(c + d) + b(c + d) = ac + ad + bc + bd.
2. (a + b)2 = a2 + 2ab + b2
as (a + b)2 = (a + b)(a + b) = a(a + b) + b(a + b)
= aa + ab + ba + bb = a2 + 2ab + b2 .
3. (a + b)3 = a3 + 3a2 b + 3ab2 + b3
as (a + b)3 = (a + b)(a + b)2 = (a + b)(a2 + 2ab + b2 )
= a(a2 + 2ab + b2 ) + b(a2 + 2ab + b2 )
= a3 + 3a2 b + 3ab2 + b3 .
4. (a b)2 = a2 2ab + b2
5. (a + b)(a b) = a2 b2
21.3
21.3.1
Fractions
Rule (multiplying and dividing two fractions)
Let a, b, c, d Z. Then
and
21.3.2
a c
ac
=
b d
bd
a
b
c
d
a d
ad
=
.
b c
bc
Let a, b, c, d Z. Then
a b
a+b
+ =
.
c c
c
If the two fractions have different denominator, a common denominator needs to be found:
a c
ad + bc
+ =
.
b d
bd
21.3.3
290
Examples
1.
x2 + 1
x2
1
1
=
+ =x+ .
x
x
x
x
2.
x
(x + 1) 1
x+1
1
1
=
=
=1
x+1
x+1
x+1 x+1
x+1
3. Simplify
1
x
1
2
x+1 x+2
1
2
1(x + 2) 2(x + 1)
x
Solution: First
=
=
x
+
1
x
+
2
(x
+
1)(x
+
2)
(x
+
1)(x
+ 2)
1
1
x
1
1
2
=
=
x x+1 x+2
x (x + 1)(x + 2)
(x + 1)(x + 2)
21.4
We may solve x2 + bx + c = 0 by first writing the quadratic polynomial x2 + bx + c in the form (x + d)2 + e,
and then solving (x + d)2 + e = 0.
Applying the formula from example 21.2.2.(2),
x2 + bx = (x + 2b )2 ( 2b )2 (check!)
x2 + bx + c = (x + 2b )2 ( 2b )2 + c = (x + d)2 + e, with d =
b
2
and e = c ( 2b )2 = c d2 .
Examples
21.4.3
291
b2 4ac
.
2a
b2
c.
4
Factorizing
Another way of solving quadratic (and higher order polynomial) equations is by factorizing. We try
to write the polynomial as a product of sums. You can sometimes use the formulas from Examples
21.2.2.(2),(4) or (5) for this. Factorizing is also used to simplify expressions.
If you cannot use one of the formulas from Examples 21.2.2.(2),(4) or (5), you can sometimes factorize
the following way. We would like to express x2 + bx + c = (x + p)(x + q). Multiplying out we have
x2 + bx + c = (x + p)(x + q) = x2 + (p + q) + pq. We now need to find p and q such that b = p + q and
c = pq. Have a look at these examples.
21.4.5
Examples
1. Factorize f (x) = x2 + 6x + 5 using the formula from Example 21.2.2.(2). Then find the zeros.
x2 + 6x + 5 = (x + 3)2 22 = ([x + 3] 2)([x + 3] + 2) = (x + 1)(x + 5).
The zeros can be read directly from this expression:
(x + 1)(x + 5) = 0 x = 1 or x = 5.
2. Factorize x2 + 3x + 2 without using the formula from Example 21.2.2.(2).
x2 + 3x + 2 = x2 + bx + c. We must find p and q such that b = 3 = p + q and c = 2 = pq.
A solution is p = 1 and q = 2, so x2 + 3x + 2 = (x + 1)(x + 2).
3. Factorize x2 7x + 6.
Now 7 = p + q and 6 = pq. A solution is p = 6 and q = 1, so x2 7x + 6 = (x 6)(x 1).
21.4.6
21.5 Surds
21.4.7
292
Examples
21.5
Surds
b=
ab
.
a+ b
To see this
b =
=
=
a + b
a b
a+ b
( a b)( a + b)
a+ b
( a)2 ( b)2
ab
.
=
a+ b
a+ b
Similarly,
21.5.1
a+
ab
b=
a b
Example
Simplify
2x + 1
x
x+1
, where x 6= 0
First
2x + 1
x+1 =
=
2x + 1
x
x+1
=
=
2
2
2x + 1
x+1
2x + 1 + x + 1
x
2x + 1 + x + 1
1
x
, where x 6= 0
x
2x + 1 + x + 1
1
, where x 6= 0
2x + 1 + x + 1