47
Numerical Mathematic Wai Hung, Chan Wai Hung, Chan Thomas, Nguyen Thomas, Nguyen

Numerical Mathematic

Embed Size (px)

DESCRIPTION

Numerical Mathematic. Wai Hung, Chan Thomas, Nguyen. Numerical Mathematic. Number Representation Round off errors Overflow and Underflow Classical Numerical Algorithms Linear Algebra. Number and their representation. ASCII – text characters Easy read and write of numbers Binary - PowerPoint PPT Presentation

Citation preview

Page 1: Numerical Mathematic

Numerical Mathematic

Wai Hung, ChanWai Hung, Chan Thomas, NguyenThomas, Nguyen

Page 2: Numerical Mathematic

Numerical Mathematic

Number RepresentationNumber RepresentationRound off errorsRound off errorsOverflow and UnderflowOverflow and UnderflowClassical Numerical AlgorithmsClassical Numerical AlgorithmsLinear AlgebraLinear Algebra

Page 3: Numerical Mathematic

Number and their representation

ASCII – text charactersASCII – text characters•Easy read and write of numbersEasy read and write of numbers

BinaryBinary•Natural form of computerNatural form of computer

Page 4: Numerical Mathematic

Binary Numbering System The binary number system is similar to the The binary number system is similar to the

decimal number system except thatdecimal number system except that All values are composed of 0’s and 1’s (instead All values are composed of 0’s and 1’s (instead

of 0-9)of 0-9) Each position in a number represents a power Each position in a number represents a power

of 2 (instead of a power of 10)of 2 (instead of a power of 10) Decimal: 729 – 7 in the 100’s position and 2 in Decimal: 729 – 7 in the 100’s position and 2 in

the 10’s position and 9 in the 1’s positionthe 10’s position and 9 in the 1’s position Binary: 1101 – 1 in the 8’s position and 1 in Binary: 1101 – 1 in the 8’s position and 1 in

the 4’s position and 0 in the 2’s position and 1 the 4’s position and 0 in the 2’s position and 1 in the 1’s positionin the 1’s position

Page 5: Numerical Mathematic

Positive Integer Representations

Convert a binary value to its equivalent Convert a binary value to its equivalent decimal value:decimal value: Examples: Examples:

011010100110101022 0*2 0*277 + 1*2 + 1*266 + 1*2 + 1*255 + +

0*20*244 + 1*2 + 1*233 + 0*2 + 0*222 + 1*2 + 1*211 + 0*2 + 0*200 = = 64 + 32 + 8 + 2 = 10664 + 32 + 8 + 2 = 1061010

Page 6: Numerical Mathematic

Number and their representation (Cont)

Binary number (base 2)Binary number (base 2) Things may become complicatedThings may become complicated

o Numbers are finite (overflow)Numbers are finite (overflow)o Fraction and real numbersFraction and real numberso Negative numbersNegative numbers

How do we represent negative number?How do we represent negative number?

Page 7: Numerical Mathematic

Representing Negative Integers Signed MagnitudeSigned Magnitude

Add 1 bit to the number at the leading Add 1 bit to the number at the leading end, this will be the sign bitend, this will be the sign bit

Positive numbers sign bit = 0Positive numbers sign bit = 0 Negative numbers sign bit = 1Negative numbers sign bit = 1 Examples:Examples:

34 = 0010001034 = 00100010-34 = 10100010-34 = 10100010

Page 8: Numerical Mathematic

Representing Negative Integers (Cont)

Two’s ComplementTwo’s Complement Improvement over Signed Magnitude because it Improvement over Signed Magnitude because it

doesn’t have either of the problemsdoesn’t have either of the problems Representation is the same for positive numbersRepresentation is the same for positive numbers For negative numbers, negate the number and then For negative numbers, negate the number and then

add 1add 1 Example:Example:

42 42 00101010 00101010-42 -42 11010101 + 1 = 11010110 11010101 + 1 = 11010110

Notice that the leading bit is still a sign bitNotice that the leading bit is still a sign bit +3 = 00000011+3 = 00000011 -3 = 11111101 -3 = 11111101 +2 = 00000010 +2 = 00000010 -2 = 11111110 -2 = 11111110 +1 = 00000001+1 = 00000001 -1 = 11111111 -1 = 11111111

Page 9: Numerical Mathematic

Working with 2’s complement Negate a numberNegate a number

o Invert every single bit (0 Invert every single bit (0 1, 1 1, 10) 0) o Add 1 to the resultAdd 1 to the result

ExampleExample

0000 00100000 0010 =2=2

1111 11011111 1101 invertedinverted

1111 11101111 1110 1 added 1 added =-2=-2

0000 00010000 0001 invertedinverted

0000 00100000 0010 1 added1 added =2=2

Page 10: Numerical Mathematic

Round off errors

Any computer can only retain a finite number of Any computer can only retain a finite number of significant digit to represent the results of an significant digit to represent the results of an operation. When an result can not be represent operation. When an result can not be represent exactly, a round off error introduced.exactly, a round off error introduced.

These are the errors the computer make in doing These are the errors the computer make in doing arithmetic. (For example, the error a computer or arithmetic. (For example, the error a computer or calculator makes in evaluating (1/3 + 1/7)). Even calculator makes in evaluating (1/3 + 1/7)). Even if we have a good formula to solve a problem it if we have a good formula to solve a problem it may not produce good answers when it evaluated may not produce good answers when it evaluated on a computer.on a computer.

Page 11: Numerical Mathematic

Round off errors (Cont)

Computers make small error when Computers make small error when they do arithmetic. they do arithmetic.

For example:For example:

11 * (15/11) -15 = 0 (?)11 * (15/11) -15 = 0 (?)

Page 12: Numerical Mathematic

Overflow and Underflow Overflow: Overflow:

If the result of a computation is larger than that If the result of a computation is larger than that allowed by the computer you have an overflow.allowed by the computer you have an overflow.

Underflow: Underflow:

In computing, a condition occurring when a In computing, a condition occurring when a machine calculation produces a non-zero result that machine calculation produces a non-zero result that is smaller than the smallest non-zero quantity that is smaller than the smallest non-zero quantity that the machine's storage unit is capable of storing or the machine's storage unit is capable of storing or representing.representing.

Page 13: Numerical Mathematic

Example: 58 – 83 = -25Example: 58 – 83 = -251.1. ConvertConvert

58 = 0011 101058 = 0011 101083 = 0101 001183 = 0101 0011

2.2. Get 2’s complementGet 2’s complement

0101 0011 0101 0011 Original number (83)Original number (83)1010 11001010 1100 Flip the bitsFlip the bits +1+1 Add 1Add 11010 11011010 1101 2’s complement2’s complement

3.3. Add the two numbers:Add the two numbers:

0011 10100011 1010 =58=58 ++ 1010 11011010 1101 2’s complement of 832’s complement of 83 1110 01111110 0111 Answer = -25 (No Answer = -25 (No

Overflow)Overflow)

Page 14: Numerical Mathematic

Overflow (Cont)

The sum of two unsigned numbers can The sum of two unsigned numbers can exceed any representationexceed any representation

0101 00110101 0011 = 83= 83

++ 0010 11110010 1111 = 47= 47

1000 00101000 0010 = -126 (Overflow)= -126 (Overflow)

Page 15: Numerical Mathematic

Detecting Overflow No overflow when adding a +ve and a -ve No overflow when adding a +ve and a -ve

number.number. No overflow when sign are the same for No overflow when sign are the same for

subtraction.subtraction. Overflow when adding two positive yields a Overflow when adding two positive yields a

negativenegative Or, adding two negative give a positiveOr, adding two negative give a positive Or, subtract a negative from a positive Or, subtract a negative from a positive

and get a negativeand get a negative Or, subtract a positive from a negative Or, subtract a positive from a negative

and get a positiveand get a positive

Page 16: Numerical Mathematic

Overflow (Cont)

OperationOperation ConditionCondition ResultResult

A+BA+B A>0 B>0A>0 B>0 <0<0

A+BA+B A<0 B<0A<0 B<0 >0>0

A – BA – B A>0 B<0A>0 B<0 <0<0

A – BA – B A<0 B>0A<0 B>0 >0>0

General Overflow Condition

Page 17: Numerical Mathematic

Sources

http://wwwmaths.anu.edu.au/DoM/secondyear/MATH2501/lect-05-4.http://wwwmaths.anu.edu.au/DoM/secondyear/MATH2501/lect-05-4.pdfpdf

http://www.maths.uq.edu.au/~gac/math2200/mn_roff.pdfhttp://www.maths.uq.edu.au/~gac/math2200/mn_roff.pdf http://lapwww.epfl.ch/courses/archord1/Computer%20Arithmetic.pdfhttp://lapwww.epfl.ch/courses/archord1/Computer%20Arithmetic.pdf http://www.cse.psu.edu/~cg575/lectures/cse575-fpops.http://www.cse.psu.edu/~cg575/lectures/cse575-fpops.pdfpdf

Page 18: Numerical Mathematic

CLASSICAL NUMERICAL ALGORITHM

TRAPEZOID RULE:TRAPEZOID RULE: (a to b) (a to b) (x) dx (x) dx Tn = Tn = x/2 [x/2 [(Xo) + 2 (Xo) + 2 (X(X11) )

+ 2+ 2(X(X22) +….+ 2 ) +….+ 2 (Xn -(Xn -11) + 2 ) + 2 (Xn) (Xn) where where x = (b - a) /n and Xi = a + i x = (b - a) /n and Xi = a + i x.x. example : Use trapezoid rule with n=5 to example : Use trapezoid rule with n=5 to

approximate integral approximate integral (1 to 2) (1/x) dx (1/x) dx with n=5, a =1, and b=2, we have with n=5, a =1, and b=2, we have x =(2-1)/5=0.2x =(2-1)/5=0.2 (1to 2) 1/x dx T5 = .2/2[T5 = .2/2[(1)+ 2(1)+ 2(1.2)+….. (1.2)+….. (2)(2) = .1[1/1 + 2/1.2 + 2/1.4+ 2/1.6 +..+1/2]= .1[1/1 + 2/1.2 + 2/1.4+ 2/1.6 +..+1/2] 0.6956350.695635

Page 19: Numerical Mathematic

MIDPOINT RULE:MIDPOINT RULE: (a to b) (a to b) (x) dx (x) dx Mn = Mn = x [x [(X(X11) + ) + (X(X22) +) + +….+ +….+ (Xn) where(Xn) where x = (b - a) /n and Xi =1/2(Xi-x = (b - a) /n and Xi =1/2(Xi-11+Xi) = +Xi) =

midpoint[Ximidpoint[Xi--11,, Xi] Xi] example : Use midpoint rule with n=5 to example : Use midpoint rule with n=5 to

approximate integral approximate integral (1 to 2) (1/x) dx (1/x) dx with n=5, a =1, and b=2, we have with n=5, a =1, and b=2, we have x =(2-1)/5=0.2x =(2-1)/5=0.2 (1to 2) 1/x dx = 1/5 [ = 1/5 [(1.1)+ 2(1.1)+ 2(1.3)+….. (1.3)+….. (1.9)(1.9) = 0.2[1/1.1 + 2/1.3 + 2/1.4+ 2/1.5 +..+1/1.9]= 0.2[1/1.1 + 2/1.3 + 2/1.4+ 2/1.5 +..+1/1.9] 0.6919080.691908

Page 20: Numerical Mathematic

SIMPSON’S RULE (a to b) (a to b) (x) dx (x) dx Sn = Sn = x/3 [x/3 [(Xo) + 4 (Xo) + 4 (X(X11) + ) +

22(X(X22) + 4) + 4(X(X33) +2) +2(Xn -2) + 4(Xn -2) + 4(Xn -1)+(Xn -1)+(Xn)](Xn)] where n is even and where n is even and x = (b - a) / nx = (b - a) / n Example: use simpson’s rule to approximateExample: use simpson’s rule to approximate (1 to 2) (1/x) dx with n=10. (1/x) dx with n=10. We have We have x =1/10=0.1x =1/10=0.1 (1 to 2) (1/x) dx (1/x) dx SS10 10 = = x/3 [x/3 [(1)+4(1)+4(1.1)+ (1.1)+

22(1.2)+ 4(1.2)+ 4(1.3)+…..+ 2(1.3)+…..+ 2(1.8)+4(1.8)+4(1.9)+ (1.9)+ (2)(2) = 0.1/3 [1/1 + 4/1.1 + 2/1/2 + 4/1.3 + 2/1.4 + 4/1.5 = 0.1/3 [1/1 + 4/1.1 + 2/1/2 + 4/1.3 + 2/1.4 + 4/1.5

+ 2/1.6 + 4/1.7 + 2/1.8 + 4/1.9 + 1/2]+ 2/1.6 + 4/1.7 + 2/1.8 + 4/1.9 + 1/2] 0.0.6931350.0.693135

Page 21: Numerical Mathematic

LINEAR EQUATION

1. 1. Introduction to linear equationsIntroduction to linear equations A A linear equation linear equation in in n n unknowns unknowns xx11; x; x22; … x; … xn n is is

an equation of the form:an equation of the form: aa11xx1 1 + + aa22xx2 2 + + + + aannxxn n = = b;b; where where aa11; a; a22; : : : ; a; : : : ; an=n= b b are given real are given real

numbers.numbers. For example, with For example, with x x and and y y instead of instead of xx1 1 and and xx22, ,

the linear equation 2the linear equation 2x x + 3+ 3y y = 6 describes the = 6 describes the line passing through the points (3line passing through the points (3; ; 0) and (00) and (0; ; 2).2).

A A system system of of m m linear equations in linear equations in n n unknowns unknowns xx11; x; x22; ; ; x; xn n is a family of linear equationsis a family of linear equations

aa11 11 xx1 1 + + aa12 12 xx2 2 + + .... .... + + a1a1n n xxn n = = bb11 aa21 21 xx1 1 + + aa22 22 xx2 2 + + …. …. + + aa22n n xxn n = = bb22 ...... aamm1 1 xx1 1 + + aamm2 2 xx2 2 + + .. .. + + aamn mn xxn n = = bbmm::

Page 22: Numerical Mathematic

INTRO(CONT) Note that the above system can be written Note that the above system can be written

concisely as concisely as jj=1=1 Σ (i=1 to m) aij Σ (i=1 to m) aij xxj j = = bbii; i ; i = 1= 1; ; 22; ; ; m:; m:

The matrix: The matrix: aa11 11 aa12 12 aa11nn

aa21 21 aa22 22 aa22nn

...... a amm1 1 aamm2 2 aamnmn

is called the is called the coefficient matrix coefficient matrix of the system, while of the system, while the matrixthe matrix

aa11 11 aa12 12 aa11n n bb11

aa21 21 aa22 22 aa22n n bb22

… … ....

aamm1 1 aamm2 2 aamn mn bbmm

is called the is called the augmented matrix augmented matrix of the system.of the system.

Page 23: Numerical Mathematic

EXAMPLE : Find a polynomial of the form y = a0+a1x+a2x^2+a3x^3which passes through the points (-3, -2), (-1, -2), (2, 1). Solution. When x has the values -3;-1; 1; 2, then y

takes corresponding values -2; 2; 5; 1 and we get four equations in the unknowns a0; a1; a2; a3.

a0 - 3a1 + 9a2- 27a3 = -2 a0 - a1 + a2 - a3 = 2 a0 + a1 + a2 + a3 = 5 a0 + 2a1 + 4a2 + 8a3 = 1: This system has the unique solution a0 = 93/20;

a1 = 221/120; a2 = -23/20; a3 = -41/120. So the required polynomial

is: y = 93/20 +221/20x –23/20x^2-41/20x^3

Page 24: Numerical Mathematic

Solving linear equations DEFINITION : (Row echelon form) A matrix is in row

echelon form if (i) all zero rows (if any) are at the bottom of the matrix (ii) if two successive rows are non zero, the second row

starts with more zeros than the first (moving from left to right).

For example: the matrix is in row echelon form 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 The matrix is not in row echelon form 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 The zero matrix of any size is always in row echelon

form.

Page 25: Numerical Mathematic

DEFINITION: (Reduced row echelon form) A matrix is in reduced row echelon form if (i). it is in row echelon form(ii). the leading (leftmost nonzero) entry in each non zero row is 1, (iii). all other elements of the column in which the leading entry 1 occurs are zeros.

For example: 1 0 0 1 0 1 2 0 0 2 0 0 0 1 0 3

0 0 0 0 1 4 0 0 0 0 0 0

Page 26: Numerical Mathematic

DEFINITION (Elementary row operations) There are three types of elementary row operations that can be performed on matrices: 1. Interchanging two rows: Ri <-> Rj interchanges rows i and j. 2. Multiplying a row by a nonzero scalar: Ri -> t Ri multiplies row i by the nonzero scalar t. 3. Adding a multiple of one row to another row: Rj -> Rj + tRi adds t times row i to row j.

1 2 0 1 2 0 A = 2 1 1 R2-->R2 +2R3 4 -1 5 1 -1 -2 1 -1 2 1 2 0 2 4 0 R2<-->R3 1 -1 2 R1-->2R1 1 -1 2 =B 4 -1 5 4 -1 5

Page 27: Numerical Mathematic

The Gauss-Jordan algorithm This is a process which starts with a given matrix A and produces a

matrix B in reduced row echelon form, which is row equivalent to A. If A is the augmented matrix of a system of linear equations, then B will be a much simpler matrix than A

STEP 1. :Find the first nonzero column moving from left to right, (column c1) and select a non zero entry from this column. By interchanging rows, if necessary, ensure that the first entry in this column is nonzero. Multiply row 1 by the multiplicative inverse of a1c1 thereby converting a1c1 to 1. For each non zero element aic1 ; i > 1, (if any) in column c1, add -aic1,time row 1 to row I, thereby, we can find all element in column c1 is apart from the first zero.

STEP 2. : If the matrix obtained at Step 1 has its 2nd; : : : ;mth rows all zero, the matrix is in reduced row echelon form. Otherwise suppose that the rst column which has a non zero element in the rows below the rst is column c2. Then c1 < c2. By interchanging rows below the first, if necessary, ensure that a2c2 is non{zero. Then convert a2c2 to 1 and by adding suitable multiples of row 2 to the remaning rows, where necessary, ensure that all remaining elements in column c2 are zero.

Page 28: Numerical Mathematic

EXAMPLE 0 0 4 0 2 2 -2 5 1 1 -1

5/2 2 2 -2 5 0 0 4 0 0 0 4

0 5 5 -1 5 R1 <->R2 5 5 -1 5 R1->-1/2 R1 5 5 -1 5

1 1 -1 5/2 1 1 -1 5/2 R3 ->R3-5R1 0 0 4 2 R2->1/4R2 0 0 1 0 0 0 4 -15/2 0 0 4 -15/2 R1->R1 + R2 1 1 0 5/2 1 1 0

5/2 R3->R3- 4R2 0 0 1 0 R3->-2/15R3 0 0 1 0 0 0 0 -15/2 0 0 0

1 1 1 0 0 R1 -> R1- 5/2R3 0 0 1 0 0 0 0 1 The last matrix is in reduced row echelon form.

Page 29: Numerical Mathematic

MATRICES Matrix arithmetic Matrices will usually be denoted by capital letters

and the equation A = [aij ] means that the element in the ith row and jth column of the matrix A equals aij . It is also occasionally convenient to write aij = (A)ij . For the present all matrices will have rational entries, unless otherwise stated.

EXAMPLE 2.1.1 The formula aij = 1/(i + j) for 1<=i<=3; 1<= j<= 4, defines a 3x4 matrix A = [aij ], namely

1/2 1/3 1/4 1/5 A = 1/3 1/4 1/5 1/6 1/4 1/5 1/6 1/7

Page 30: Numerical Mathematic

DEFINITION:(Equality of matrices) Matrices A and B are said to be equal if A and B have the same size and corresponding elements are equal; that is A and B є Mmxn(F) and A = [aij ]; B = [bij ], with aij = bij for 1<= i <= m; 1<= j<= n.

DEFINITION:(Addition of matrices) Let A = [aij ] and B =[bij] be of the same size. Then A + B is the matrix obtained by adding corresponding elements of A and B; that is A + B = [aij ] + [bij ] = [aij + bij ].

DEFINITION :(Scalar multiple of a matrix) Let A = [aij ] and t є F (that is t is a Scalar). Then tA is the matrix obtained by multiplying all elements of A by t; that is tA = t[aij ] = [taij ].

Page 31: Numerical Mathematic

DEFINITION 2.1.4 (Additive inverse of a matrix) Let A = [aij ] .Then ¡A is the matrix obtained by replacing the elements of A by their additive inverses; that is A = -[aij ] = [-aij ]:

DEFINITION 2.1.5 (Subtraction of matrices) Matrix subtraction is defined for two matrices A = [aij ] and B = [bij ] of the same size, in the usual way; that is A - B = [aij ] - [bij ] = [aij - bij ]:

DEFINITION 2.1.6 (The zero matrix) For each m; n the matrix inMmxn(F), all of whose elements are zero, is called the zero matrix (of size mxn) and is denoted by the symbol 0.

Page 32: Numerical Mathematic

The matrix operations of addition, scalar multiplication, additive inverse and subtraction satisfy the usual laws of arithmetic.

1. (A + B) + C = A + (B + C); 2. A + B = B + A; 3. 0 + A = A; 4. A + (-A) = 0; 5. (s + t)A = sA + tA, (s x t)A = sA x tA; 6. t(A + B) = tA + tB, t(A + B) = tA + tB; 7. s(tA) = (st)A; 8. 1A = A, 0A = 0, (-1)A = -A; 9. tA = 0 => t = 0 or A = 0.

Page 33: Numerical Mathematic

DEFINITION: (Matrix product) Let A = [aij ] be a matrix of size m x n and B = [bjk] be a matrix of size n x p; (that is the number of columns of A equals the number of rows of B). Then AB is the m x p matrix C = [cik] whose (i, k)th element is defined by the formula:

cik = Σ(j=1 to n) aijbjk = ai1*b1k + .. + ain*bnk. Example: 1 2 5 6 = 1*5 +2*7 1*6 +2*8 = 19 22 3 4 7 8 385 +4*7 3*6 +4*8 43 50 5 6 1 2 23 34 1 2 5 6 7 8 3 4 = 41 46 = 3 4 7 8

Page 34: Numerical Mathematic

Matrix product (cont) Matrix multiplication obeys many of the familiar

laws of arithmetic apart from the commutative law.

1. (AB)C = A(BC) if A; B; C are mxn; nxp; pxq, respectively;

2. t(AB) = (tA)B = A(tB), A(-B) = (-A)B = -(AB); 3. (A + B)C = AC + BC if A and B are mxn and C

is nxp; 4. D(A + B) = DA + DB if A and B are mxn and D

is pxm.

Page 35: Numerical Mathematic

Example: Let A, B, C, D be matrices defined by A = 3 0 B = 1 5 2 C = -3 -1 -1 2 -1 1 0 2 1 1 1 -4 1 3 4 3 C = 4 -1 2 0 Which of the following matrices are

defined? A + B; A + C; AB; BA; CD; DC; D^2:

Page 36: Numerical Mathematic

THEOREM (Cramer's rule for 2 equations in 2 unknowns) The system: ax + by = e cx + dy = f a b has a unique solution if Δ = c d = 0 namely

X= Δ1/Δ, Y= Δ2/Δ where Δ1 = e b , Δ2 = a e f d c f

EXAMPLE : the system 7x + 8y = 100 2x - 9y = 10 Δ= 7 8 Δ1= 100 8 Δ2= 7 100 2 -9 = -79 10 9 =-980 2 10 =-130 So

the system has unique solution X = 980 / 79 , Y = 130 / 79

Page 37: Numerical Mathematic

DETERMINANTS

DEFINITION: If A = a11 a12 a21 a22 ¸ we define the

determinant of A, (also denoted by det A,) to be the scalar det A = a11*a22 - a12*a21:

DEFINITION: (Minor) Let Mij(A) (or simply Mij if there is no ambiguity) denote the determinant of the (n -1) and (n - 1) sub matrix of A formed by deleting the ith row and jth column of A. (Mij(A) is called the (i, j) minor of A.)

The determinant function has been defined for matrices of size (n-1)x(n-1). Then det A is defined by the so called first-row Laplace expansion.

Page 38: Numerical Mathematic

detA = a11M11(A) - a12 M12(A) + ……. + (-1)^1+n M1n(A) = Σ(j=1 to n) (-1)^1+j a1j M1j(A): For example: if A = [aij ] is a 3 x 3 matrix, the

Laplace expansion gives: detA = a11 M11(A) - a12 M12(A) + a13 M13(A) = a11(a22a33 - a23a32) - a12(a21a33-

a23a31) + a13(a21a32 - a22a31) = a11a22a33 - a11a23a32 - a12a21a33 +

a12a23a31 + a13a21a32 - a13a22a31

Page 39: Numerical Mathematic

THEOREM: Let A = [aij ], where aij = 0 if i < j. Then detA = a11*a22*…*ann, an important special case is when A is a diagonal matrix.

a11 0 0 0 ... 0 a11 0 0 0 ... 0 a21 a22 …...….0 a21 a22 …...….0 det A = … a33 0det A = … a33 0 an1 an2 ……annan1 an2 ……ann det A = a11 (a22………ann)det A = a11 (a22………ann) 1 0 0 01 0 0 0 det A = 3 3 0 0 = 18det A = 3 3 0 0 = 18 4 3 3 0 4 3 3 0 1 3 4 21 3 4 2

Page 40: Numerical Mathematic

THEOREM: detA = Σ (j=1 to n) (-1)^i+j aij Mij(A)for i = 1,.,n (the so-called i-th row expansion) and

detA = Σ(i=1to n)(-1)^i+j aij Mij(A)for j= 1,...,n(the so-called j-th column expansion).

The expression (-1)i+j obeys the chess board pattern of signs:

+ - + - ……. - + - +……. + - + - …… .. ..

Page 41: Numerical Mathematic

DEFINITION: (Cofactor) The (i, j) cofactor of A, denoted by Cij(A) (or Cij if there is no ambiguity) is defined by Cij(A) = (-1)^i+j Mij(A).

DEFINITION: (Adjoint) If A = [aij ] is an nxn matrix, the ad-joint of A, denoted by adjA, is the transpose of the matrix of cofactors.

C11 C21 ….. Cn1 adj A = C12 C22 …. Cn2 .. ….. C1n C2n …..Cnn THEOREM: Let A be an n x n matrix. Then A(adjA) = (adjA)A.

Page 42: Numerical Mathematic

If detA = 0, then A is nonsingular and A^-1 = (1/ detA) adj A. Example: 1 2 3 det A = 4 5 6 = -3 = 0 7 8 9 C11 C21 C31 A^-1 = - 1/3 A^-1 = - 1/3 C12 C22 C32 C13 C23 C33 -3 6 -3 A^-1 = -1/3 12 -15 6 -8 8 -3

Page 43: Numerical Mathematic

EIGENVALUES AND EIGENVECTORS Motivation:Motivation: We motivate the chapter on eigenvalues

by discussing the equation: ax^2 + 2hxy + by^2 = c

where not all of a; h; b are zero. The expression ax2 + 2hxy + by2 is called a quadratic form in x and y and we have the identity

ax^2 + 2hxy + by^2 = x y a h x = X^t AX h b y where X = x a h y and A = h b . A is called the

matrix of the quadratic form.

Page 44: Numerical Mathematic

A has characteristic equation:A has characteristic equation: λλ² - (a+b) ² - (a+b) λλ + ab - h² = 0 + ab - h² = 0 this called this called eigenvalue equation of the matrix A. DEFINITION (Eigenvalue, eigenvector) Let A be a complex square matrix. Then if ¸λλ is a

complex number and X a non-zero complex column vector satisfying AX = λλX, we call X an

eigenvector of A, while ¸ λ λ is called an eigenvalue of A.

if ¸ λ λ is an eigenvalue of an nxn matrix A, with corresponding eigenvector X, then (A -λInλIn)X = 0,

with X = 0, so det (A - λInλIn) = 0 and there are at most n distinct eigenvalues of A.

Page 45: Numerical Mathematic

EXAMPLE: Find the eigenvalues and eigen- vectors of A = 2 1 1 2 Solution. The characteristic equation of A is λλ²² - 4 λλ + 3 = 0, or (λλ - - 1)(λλ - - 3) = 0

Hence λλ = 1 or 3. The eigenvector equation (A - λλ In)X = 0 reduces to 2-λ 1 x 0λ 1 x 0

1 2- λ y = 0λ y = 0 or (2 - λ)xλ)x + y = 0 x + (2 - λλ)y = 0: Taking λ =1 give x + y = 0λ =1 give x + y = 0 x + y = 0x + y = 0

Page 46: Numerical Mathematic

Which has solution x = -y, y Which has solution x = -y, y arbitrary. Consequently the eigenvectors corre-sponding

to λλ = 1 are the vectors -y with y = 0 y Taking λ = 3 give -x + y = 0λ = 3 give -x + y = 0 x + y = 0x + y = 0 which has solution x = y, y arbitrary.

Consequently the eigenvectors corre-sponding to λ = 3 λ = 3 are the vectors y with y =

0 y

Page 47: Numerical Mathematic

Reference sources

www.maths.uq.edu.au/~krm/ela.html