chapter 0 introduction - lecture-notes.tiu.edu.iq

59
Chapter 0 Introduction: 0.1 Introduction to linear algebra: Mathematics is the background of every engineering fields. Together with physics, mathematics has helped engineering develop. Without it, engineering cannot have evolved so fast we can see today. Also mathematics is useful in so many areas because it is abstract: the same good idea can unlock the problems of control engineers, civil engineers, physicists, social scientists, and mathematicians only because the idea has been abstracted from a particular setting. One technique solves many problems only because someone has established a theory of how to deal with these kinds of problems. We use definitions to try to capture important ideas, and we use theorems to summarize useful general facts about the kind of problems we are studying. Proofs not only show us that a statement is true; they can help us understand the statement, give us practice using important ideas, and make it easier to learn a given subject. Without mathematics, engineering cannot become so fascinating as it is now. numerical analysis (Which will be our subject), calculus, statistics, differential equations and Linear algebra are taught as they are important to understand many engineering subjects such as fluid mechanics, heat transfer, electric circuits, Computer engineering and mechanics of materials to name a few. it is accurate to say that a discrete math course and calculus indeed provides sufficient mathematical background for a computer scientist and engineering working in the โ€œcoreโ€ areas of the field, such as databases, compilers, operating systems, architecture, and networks. Other mathematical issues no doubt arise even in these areas, but peripherally and unsystematically; the computer scientist can learn the math needed as it arises.

Upload: others

Post on 24-Jan-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

Chapter 0 Introduction:

0.1 Introduction to linear algebra:

Mathematics is the background of every engineering fields. Together with physics,

mathematics has helped engineering develop. Without it, engineering cannot have

evolved so fast we can see today.

Also mathematics is useful in so many areas because it is abstract: the same good

idea can unlock the problems of control engineers, civil engineers, physicists, social

scientists, and mathematicians only because the idea has been abstracted from a

particular setting. One technique solves many problems only because someone has

established a theory of how to deal with these kinds of problems.

We use definitions to try to capture important ideas, and we use theorems to

summarize useful general facts about the kind of problems we are studying. Proofs

not only show us that a statement is true; they can help us understand the

statement, give us practice using important ideas, and make it easier to learn a

given subject.

Without mathematics, engineering cannot become so fascinating as it is now.

numerical analysis (Which will be our subject), calculus, statistics, differential

equations and Linear algebra are taught as they are important to understand many

engineering subjects such as fluid mechanics, heat transfer, electric circuits,

Computer engineering and mechanics of materials to name a few.

it is accurate to say that a discrete math course and calculus indeed provides

sufficient mathematical background for a computer scientist and engineering

working in the โ€œcoreโ€ areas of the field, such as databases, compilers, operating

systems, architecture, and networks. Other mathematical issues no doubt arise

even in these areas, but peripherally and unsystematically; the computer scientist

can learn the math needed as it arises.

However, Numerical analysis can be defined as the development and

implementation of techniques to find numerical solution to mathematic,

Engineering and science problems. It also involves mathematics in developing

techniques for the approximate solution for the implementation of these

techniques in an optimal fashion for the particular computer programs. With the

accessibility of computers, it is now possible to get rapid and accurate solution to

many complex problems that create difficulties for, the mathematician, engineer

and scientist.

When engineering system are modeled, the mathematical description is developed

in term of sets of algebraic equation. Sometime these equations are linear and

sometime nonlinear. In first part we discuss systems of linear equation and how to

solve them using direct methods.

However, The solution of a system of linear algebraic equation probably one of the

most important topic in engineering computations.

In second part we will study one of the most fundamental problems of numerical

analysis, namely the numerical solution of nonlinear equations. Where most

equations are arising in practice are nonlinear and are of a form that allows the

roots to be determined exactly. Consequently, numerical methods are used to

solve nonlinear equations when the equations prove intractable to ordinary

mathematical techniques. These numerical methods are all iterative. At part three

we will describe numerical methods for the approximation of functions other than

elementary functions. Where the main purpose of these techniques is to replace a

complicated function by one that simpler and more manageable. Finally, in part

four we will deal with techniques for approximating numerically the two

fundamental operations of calculus, differentiation and integrations. Both of these

problems may be approached in the same way. Although both numerical

differentiation and numerical integration formulas will be discussed.

What does the term linear equation mean?

An equation is where two mathematical expressions are defined as being equal. A

linear equation is one where all the variables such as

x, y, z

have index (power) of 1 or 0 only,

for example

x + 2y + z = 5

is a linear equation. The following are also linear equations:

x = 3;

x + 2y = 5;

3x + y + z + w = โˆ’8

The following are not linear equations:

1. ๐‘ฅ2 โˆ’ 1 = 0

2. ๐‘ฅ + ๐‘ฆ4 + โˆš๐‘ง = 9

3. sin(x) โˆ’ y + z = 3

Why not?

In equation (1) the index (power) of the variable x is 2, so this is actually a quadratic

equation.

In equation (2) the index of y is 4 and z is 1/2.

In equation (3) the variable x is an argument of the trigonometric function sine.

Note that if an equation contains an argument of trigonometric, exponential,

logarithmic or hyperbolic functions then the equation is not linear.

A set of linear equations is called a linear system.

In this course on linear algebra we examine the following questions regarding

linear systems:

โ— Are there any solutions?

โ— Does the system have no solution, a unique solution or an infinite number of

solutions?

โ— How can we find all the solutions, if they exist?

โ— Is there some sort of structure to the solutions?

Linear algebra is a systematic exploration of linear equations and is related to โ€˜a

new kind of arithmeticโ€™ called the arithmetic of matrices which we will discuss later

in the chapter.

However, linear algebra isnโ€™t exclusively about solving linear systems. The tools of

matrices and vectors have a whole wealth of applications in the fields of functional

analysis and quantum mechanics, where inner product spaces are important. Other

applications include optimization and approximation where the critical questions

are:

1. Given a set of points, whatโ€™s the best linear model for them?

2. Given a function, whatโ€™s the best polynomial approximation to it?

To solve these problems, we need to use the concepts of eigenvalues and

eigenvectors and orthonormal bases which are discussed in later chapters. In all of

mathematics, the concept of linearization is critical because linear problems are

very well understood and we can say a lot about them. For this reason, we try to

convert many areas of mathematics to linear problems so that we can solve them.

Linear algebra is essentially the study of vectors, matrices, and linear mappings.

Many of the concepts introduced in linear algebra are natural and easy, but some

may seem unnatural and "technical" to beginners. Do not avoid these apparently

more difficult ideas; use examples and theorems to see how these ideas are an

essential part of the story of linear algebra.

0.2 Introduction to matrix:

Engineering Mathematics is applied in our daily life. Applied Mathematics is future

classified as vector algebra, differential calculus, integration, discrete Mathematics,

Matrices etc. Matrices are one of the most powerful tools in mathematics. The

evolution of the concept of matrices is the result of an attempt to obtain compact

and simple methods of solving the system of linear equations.

Matrices have a long history of application in solving linear equations. The first

example of the use of matrix methods to solve simultaneous equations, including

the concept of determinants. In this semester we will study overview of application

of matrices in engineering and science.

A Matrices is a two dimensional arrangement of numbers in row and column

enclosed by a pair of square brackets or can say matrices are nothing but the

rectangular arrangement of numbers, expression, symbols which are arranged in

column and rows. Matrices find many applications in scientific field and apply to

practical real life problem.

The scientist understand that the originality of matrix came from the study of

system of simultaneous linear equation.

0.3 Applications of Matrices:

Matrices have many applications in diverse fields of science, commerce and social

science. Matrices are used.

1- Use of Matrices in Computer Graphics

Matrix transforms are very useful within the world of computer graphics,

Software and hardware graphics processor uses matrices for performing

operations such as scaling translation, reflection and rotation.

In video gaming industry matrices are major mathematical tool to construct and

manipulate a realistic animation of a polygonal figure. Computer graphics software

uses matrices to process linear transformations to translate images. For this

purpose, square matrices are very easily representing linear transformation of

objects.

Matrices can play a vital role in the projection of three dimensional images into

two dimensional screens, creating the realistic decreeing motion. In Graphics,

digital image is treated as a matrix to be start with. The rows and columns of matrix

correspond to rows and columns of pixels and the numerical entries correspond

to the pixelsโ€™ color values.

Now dayโ€™s matrices are used in the ranking of web pages in the Google search. It

can also be used in generalization of analytical motion like experimental &

derivatives to their high dimensional.

2- Use of matrices in cryptography:

The most important usages of matrices in computer side application are

encryption of message codes with the help of encryptions only, internal function

are working and even could work with transmission of sensitive & private data.

Cryptography is the technique to encrypting data so that only the relevant person

can get the data and relate information. In earlier days, video signals were not

used to encrypt. Anyone with satellite dish was able to watch videos which results

in the loss for satellite owners, so they started encrypting the video signals so that

only those who have videos cipher can unencryptedthe signals.

This encrypting is done by using an invertible key is not invertible then the

encrypted signals cannot be unencrypted and they cannot get back to original

form. This process is done using matrices.

A digital audio or video signal is firstly taken as a sequence of numbers

representing the variation over time of air pressure of an acoustic audio signal.

The filtering techniques are used which depends on matrix multiplication.

3- Use of Matrices in Wireless Communication

Matrix Cramerโ€™s Rule and determinants are simple and important tools for solving

many problems in business and economics related to maximize profit and

minimize loss. Matrices are used to find variance and co- variance.

4- Use in data analysis:

Matrices are very useful for organization, like for scientists who have to record

data form their experiments if it includes numbers.

In engineering reports are recorded using matrices

5- Matrices for Financial Records:

Matrices allow to represent array of many numbers as a single object and is

denoted by a single symbol then calculations are performed on these symbols

in very compact form. The matrix method of obtaining opening and closing

balances for any accounting period is very efficient, accurate and less time

consuming.

6- Matrices for Engineering:

Matrices applications involve the use of Eigen values and Eigen vectors in the

process of transforming a given matrix into a diagonal matrix. Linear algebra is

useful tool for solving large number of variables in such a short time. It is

interesting to note that many of the calculus theorems used in engineering classes

are proved quickly and easily through linear algebra.

Transformation matrices are commonly used in computer graphics and image

processing.

7- Matrices are used in robotics & automation:

in terms of base elements for the robot movements. The movements of the robots

are programmed with the calculation of matrices โ€˜row &column โ€œControlling of

matrices are done by calculation of matrices.

8- Also matrices are also used in geology for seismic survey and it is also used for

plotting graphs.

Matrices used in Statistics plays a vital role in scientific studies.

Chapter 1: Introduction to system of linear equation:

Connecting theory and application is a challenging but important problem. This is

important for all students. We need to motivate our engineering students so they

can be successful in their educational and occupational lives. Linear systems of

equations naturally occur in many places in engineering, such as structural analysis,

dynamics and electric circuits. Computers have made it possible to quickly and

accurately solve larger and larger systems of equations. Not only has this allowed

engineers to handle more and more complex problems where linear systems

naturally occur, but has also prompted engineers to use linear systems to solve

problems where they do not naturally occur such as thermodynamics, strain

analysis, fluids and chemical processes. It has become standard practice in many

areas to analyze a problem by transforming it into a linear systems of equations

and then solving those equations by computer.

In this way, computers have made linear systems of equations the most frequently

used tool in modern engineering.

1.1 System of linear equations

Recall that the general equation of a line in ๐‘…2 is of the form

๐‘Ž๐‘ฅ + ๐‘๐‘ฆ = ๐‘

and that the general equation of a plane in ๐‘…3 is of the form

๐‘Ž๐‘ฅ + ๐‘๐‘ฆ + ๐‘๐‘ง = ๐‘‘

Equations of this form are called linear equations.

Definition : A linear equation in the n variables ๐‘ฅ1, ๐‘ฅ2 , โ€ฆ . , ๐‘ฅ๐‘› is an equation that

can be written in the form

๐‘Ž1๐‘ฅ1 + ๐‘Ž2๐‘ฅ2 + โ‹ฏ + ๐‘Ž๐‘›๐‘ฅ๐‘› = ๐‘

where the coefficients ๐‘Ž1, ๐‘Ž2 , โ€ฆ , ๐‘Ž๐‘› and the constant term b are constants.

For example, the following system has four equations and three variables:

3๐‘ฅ1 โˆ’ 2๐‘ฅ2 โˆ’ 5๐‘ฅ3 = 4

2๐‘ฅ1 + 4๐‘ฅ2 โˆ’ ๐‘ฅ3 =2

6๐‘ฅ1 โˆ’ 4๐‘ฅ2 โˆ’ 10๐‘ฅ3 = 8

โˆ’4๐‘ฅ1 + 8๐‘ฅ2 + 9๐‘ฅ3 = โˆ’6

We often need to find the solutions to a given system. The ordered triple, or 3-

tuple, (๐‘ฅ1, ๐‘ฅ2, ๐‘ฅ3) = (4, โˆ’1, 2) is a solution to the preceding system because each

equation in the system is satisfied for these values of ๐‘ฅ1, ๐‘ฅ2, and ๐‘ฅ3. Notice that

(โˆ’3

2 ,

3

4 , โˆ’2) is another solution for that same system. These two particular

solutions are part of the complete set of all solutions for that system. We now

formally define linear systems and their solutions.

The system of m linear equation in n variables๐‘ฅ1, ๐‘ฅ2, ๐‘ฅ3,โ€ฆ โ€ฆ, ๐‘ฅ๐‘› is of the form

๐‘Ž11๐‘ฅ1+๐‘Ž12๐‘ฅ2 + โ‹ฏ โ‹ฏ + ๐‘Ž1๐‘›๐‘ฅ๐‘› = ๐‘1

๐‘Ž11๐‘ฅ1+๐‘Ž12๐‘ฅ2 + โ‹ฏ โ‹ฏ + ๐‘Ž1๐‘›๐‘ฅ๐‘› = ๐‘1

โ‹ฎ โ‹ฎ + โ‹ฏ โ‹ฏ + โ‹ฎ = โ‹ฎ

๐‘Ž๐‘š1๐‘ฅ1+๐‘Ž๐‘š2๐‘ฅ2 + โ‹ฏ โ‹ฏ + ๐‘Ž๐‘š๐‘›๐‘ฅ๐‘› = ๐‘๐‘š

1.2 Solving linear systems using Gaussian eliminations:

In this section, we introduce a method for solving such systems known as Gaussian

Elimination.

Example:

๐‘ฅ + 2๐‘ฆ + ๐‘ง = 1

3๐‘ฅ + ๐‘ฆ + 4๐‘ง = 0

2๐‘ฅ + 2๐‘ฆ + 3๐‘ง = 2

is a linear system in the variables x, y, and z.

Finding all solutions to this system is not hard. We begin by subtracting three times

the first equation from the second, producing.

๐‘ฅ + 2๐‘ฆ + ๐‘ง = 1

โˆ’ 5๐‘ฆ + ๐‘ง = 0

2๐‘ฅ + 2๐‘ฆ + 3 ๐‘ง = 2

Any x, y, and z that satisfy the original system also satisfy the system above. Thus

both systems have the same solution set. We say that these systems are equivalent.

Definition: Two systems of linear equations in the same variables are equivalent if

they have the same solution set.

To continue the solution process, we next subtract twice the first equation from

the third, producing.

๐‘ฅ + 2๐‘ฆ + ๐‘ง = 1

โˆ’ 5๐‘ฆ + ๐‘ง = โˆ’3

โˆ’ 2๐‘ฆ + ๐‘ง = 0

Note that we have eliminated all occurrences of x from the second and third

equations. This system is equivalent with our second system for similar reasons

that the second system was equivalent with the first. It follows that this system has

the same solution set as the original system.

Next, we eliminate y from the third equation by subtracting twice the second from

five times the third, again producing an equivalent system:

๐‘ฅ + 2๐‘ฆ + ๐‘ง = 1

โˆ’ 5๐‘ฆ + ๐‘ง = โˆ’3

3 ๐‘ง = 6

Thus, z = 2. Then, from the second equation, y = 1, and finally, from the first

equation, x = โˆ’3. Thus, our only solution is [โˆ’3, 1, 2].

The fact that there was only one solution can be understood geometrically.

Remark. The method we used to compute the solution from system (1.11) is

referred to as back substitution. In general, in back substitution, we solve the last

equation for one variable and then substitute the result into the preceding

equations, obtaining a system with one fewer variable and one fewer equation, to

which the same process may be repeated. In this way, we obtain all solutions to the

system.

The process we used to reduce system (1) to system (2) is called Gaussian

elimination. The general idea is to use the first equation to eliminate all occurrences

of the first variable from the equations below it.

One then attempts to use the second equation to eliminate the next variable from

all equations below it, and so on. In the end, the last variable is determined first

and then the others are determined by substitution as in the example.

We will describe Gaussian elimination in detail in the next chapter, after we

introduce the notion of Matrix.

The system solved in Example 3 is a particularly simple one. However, the solution

procedure introduces all the steps that are needed in the process of elimination.

They are worth reviewing. Types of Steps in Elimination

(1) Multiply one equation by a non-zero constant.

(2) Interchange two equations.

(3) Add a multiple of one equation to another equation.

Our approach to solving a system of linear equations is to transform the given

system into an equivalent one that is easier to solve. The triangular pattern of the

second example above (in which the second equation has one less variable than

the first) is what we will aim for.

Ex: Finding the solutions to this given system

๐‘ฅ + 2๐‘ฆ + 4๐‘ง = 7

3๐‘ฅ + 7๐‘ฆ + 2๐‘ง = โˆ’11

2๐‘ฅ + 3๐‘ฆ + 3๐‘ง = 1

1.3 Types of solutions

We now go back to evaluating a simple system of two linear simultaneous

equations and discuss the case where we have no, or an infinite number of

solutions. As one of the fundamental questions of linear algebra is how many

solutions do we have of a given linear system.

The graphs represent the three possible solutions to a linear system with two

unknowns.

Example: Solve the following systems of linear equations:

1- ๐‘ฅ + ๐‘ฆ = 6 2- ๐‘ฅ + ๐‘ฆ = 2 3- ๐‘ฅ + ๐‘ฆ = 6

โˆ’๐‘ฅ + ๐‘ฆ = 2 ๐‘ฅ + ๐‘ฆ = 6 2๐‘ฅ + 2๐‘ฆ = 12

Solution :

1- Adding the two equations together gives 2y = 8, so y = 4, from which we find

that x= 2. A quick check confirms that [2, 4] is indeed a solution of both

equations. That this is the only solution can be seen by observing that this

solution corresponds to the (unique) point of intersection.

2- Two numbers x and y cannot simultaneously have a sum of 2 and 6. Hence,

this system has no solutions. As Figure (2) shows, the lines for the equations

are parallel in this case

3- The second equation in this system is just twice the first, so the solutions are

the solutions of the first equation alone-namely, the points on the line x + y

= 6. These can be represented parametrically as [2 + t, t] . Thus, this system

has infinitely many solutions [Figure (3)].

Note: A system of linear equations is called consistent if it has at least one

solution. A system with no solutions is called inconsistent. Even though they are

small, the three systems in above Example illustrate the only three possibilities

for the number of solutions of a system of linear equations with real coefficients.

Ex: Solve the following systems of linear equations and explain the types using

presentation graph :

1- 2๐‘ฅ + 2๐‘ฆ = 4 2- 2๐‘ฅ โˆ’ ๐‘ฆ = โˆ’3 3- 3๐‘ฅ + ๐‘ฆ = 1

2๐‘ฅ โˆ’ ๐‘ฆ = 8 4๐‘ฅ โˆ’ 2๐‘ฆ = โˆ’6 3๐‘ฅ + ๐‘ฆ = 5

Note: Systems of equations are a very useful tool for modeling real-life situations

and answering questions about them. If you can translate the application into two

linear equations with two variables or more, then you have a system of equations

that you can solve to find the solution. You can use any method to solve the system

of equations.

Example : Suppose you want to know the win/loss record of your favorer football

team. You know they played 24 games during the season, and you also know that

they won 15 more games than they lost. We are looking for the number of wins

and the number of losses, so we have two unknowns.

Note: Systems of equations are used to solve applications when there is more than

one unknown and there is enough information to set up equations in those

unknowns. In general, if there are n unknowns, we need enough information to set

up n equations in those unknowns.

Solution: The first thing we want to do is represent our unknowns using variables. Let's let

x = number of wins and

y= number of losses.

We are given that the team played 24 games total. We know that the number of wins plus the number of losses has to equal the total number of games played. Therefore,

x + y = 24.

We have our first equation.

Since there are two unknowns, we know we want one more equation. We are told that the team won 15 more games than they lost. This tells us that the number of losses plus 15 would give the number of wins.

Putting that in equation form, we have that

y + 15 = x.

We have our second equation, so we have our system of equations.

x + y = 24.

-x + y = -15.

Note: One application of system of equations are known as value problems. Value problems are ones where each variable has a value attached to it.

Ex: the marketing team for an event venue wants to know how to focus their advertising based on who is attending specific eventsโ€”children, or adults? They know the cost of a ticket to a basketball game is $20.00 for children and $30.00 for adults.

Additionally, on a certain day, attendance at the game is 4,000 and the total gate revenue is $80,000. How can the marketing team use this information to find out whether to spend more money on advertising directed toward children or adults?

Ex: A total of $8,300 was invested in two accounts. Part was invested in a computer at a 4% annual interest rate and part was invested in a money market fund at a 5% annual interest rate. If the total simple interest for one year was $260, then how much was invested in each account.

Ex: A farmer has three types of milk, one that is 24% butterfat, 15% butterfat and another which is 18% butterfat. How much of each should he use to end up with 44 gallons of 25% butterfat.

In Figure a the three planes intersect at a point corresponding to the situation in

which System has a unique solution.

Figure b depicts a situation in which there are infinitely many solutions to the

system. Here, the three planes intersect along a line, and the solutions are represented by the infinitely many points lying on this line.

In Figure c, the three planes are parallel and distinct, so there is no point in common

to all three planes; System has no solution in this case.

Example: Manufactur wishes to produce three types of souvenirs: types A, B, and

C. To manufacture

Type-A souvenir requires 2 minutes on machine I, 1 minute on machine II, and 2

minutes on machine III.

Type-B souvenir requires 1 minute on machine I, 3 minutes on machine II, and 1

minute on machine III.

Type-C souvenir requires 1 minute on machine I and 2 minutes each on machines

II and III.

There are 3 hours available on machine I, 5 hours available on machine II, and 4

hours available on machine III for processing the order. How many souvenirs of

each type should make in order to use all of the available time? Formulate and

solve the problem.

Solution: The given information may be tabulated as follows.

Type A Type B Type C Time Available (min)

Machine I 2 1 1 180

Machine II 1 3 2 300

Machine III 2 1 2 240

We have to determine the number of each of three types of souvenirs to be made.

So, let x, y, and z denote the respective numbers of type-A, type-B, and type-C

souvenirs to be made.

The total amount of time that machine I is used is given by 2x + y+ z minutes and

must equal 180 minutes. This leads to the equation

2๐‘ฅ + ๐‘ฆ + ๐‘ง = 180 Time spent on machine I

Similar considerations on the use of machines II and III lead to the following

equations:

๐‘ฅ + 3๐‘ฆ + 2๐‘ง = 300 Time spent on machine II

2๐‘ฅ + ๐‘ฆ + 2๐‘ง = 240 Time spent on machine III

Then the solution to the problem is found by solving the following system of linear

equations: illustrates each of these possibilities.

2๐‘ฅ + ๐‘ฆ + ๐‘ง = 180

๐‘ฅ + 3๐‘ฆ + 2 ๐‘ง = 300

2๐‘ฅ + ๐‘ฆ + 2๐‘ง = 240

Chapter 2: Introduction to Matrices and Matrix algebra

2.1 Introduction:

Information in science, business, engineering and mathematics is often organized

into rows and columns to form rectangular arrays called โ€œmatricesโ€ (plural of

โ€œmatrixโ€). Matrices often appear as tables of numerical data that arise from

physical observations, but they occur in various mathematical contexts as well. For

example, we will see in the coming chapters that all of the information required to

solve a system of linear equations such as

5๐‘ฅ + ๐‘ฆ = 3

2๐‘ฅ โˆ’ ๐‘ฆ = 4

is embodied in the matrix

(5 1 โ‹ฎ 32 โˆ’1 โ‹ฎ 4

)

and that the solution of the system can be obtained by performing appropriate

operations on this matrix. This is particularly important in developing computer

programs for solving systems of equations because computers are well suited for

manipulating arrays of numerical information.

However, matrices are not simply a notational tool for solving systems of

equations; they can be viewed as mathematical objects in their own right, and

there is a rich and important theory associated with them that has a multitude of

practical applications. It is the study of matrices and related topics that forms the

mathematical field that we call โ€œlinear algebra and Analysis.โ€ In this chapter we will

begin our study of matrices.

Image and its Matrix:

There is a relation between matrices and digital images. A digital image in a

computer is presented by pixels matrix. On the other hand, there is a need

(especially with high dimensions matrices) to present matrix with an image.

The images you see on internet pages and the photos you take with your mobile

phone are examples of digital images. It is possible to represent this kind of image

using matrices. For example, the small image of Felix the Cat

can be represented by a

35ร—35 matrix

whose elements are the numbers 0 and 1. These numbers specify the color of each

pixel1: the number 0 indicates black, and the number 1 indicates white. Digital

images using only two colors are called binary images.

Grayscale images can also be represented by matrices. Each element of the matrix

determines the intensity of the corresponding pixel.

Note: A pixel is the smallest graphical element of a matricial image, which can take

only one color at a time

For convenience, most of the current digital files use integer numbers between 0

(to indicate black, the color of minimal intensity) and 255 (to indicate white,

maximum intensity), giving a total of

256 = 28

different levels of gray.

For example, the image is presented with the matrix

Color images, in turn, can be represented by three matrices. Each matrix specifies

the amount of Red, Green and Blue that makes up the image.

This color system is known as RGB. The elements of these matrices are integer

numbers between 0 and 255, and they determine the intensity of the pixel with

respect to the color of the matrix. Thus, in the RGB system, it is possible to

represent

2563 = 224 = 16777216

different colors

2.1: Definition of Matrix and special Matrices:

The purpose of this section is to introduce the notion of a matrix, give some

motivation and some special matrix and make the basic definitions used in matrix

algebra and solving linear equations in coming chapters

Definition: A matrix is a rectangular array of objects or elements, denoted by

A โˆถ= [

๐‘Ž11 ๐‘Ž12 โ€ฆ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 ๐‘Ž๐‘š๐‘›

]

The displayed matrix has (m) rows and (n) columns and is called an m by n matrix

or matrix of order (m ร— n).

1. The size of the matrix is denoted by (m ร— n).

2. Each entry in the matrix is called the entry or elements of the matrix and is

denoted by (aij ), where (i) is the row number and (j) is the column number

of the element.

Example :

A = [2 1 3 41 3 0 24 3 5 6

]

There are (3) rows and (4) columns, so the size of A is (3ร—4) and (a23 = 0) ,

(a32 = 3).

1- Square matrix: is a matrix where number of row = number of column.

2- Symmetric matrix: is a square matrix where (aij = aji) for all(i โ‰  j).

Example :

B = [o 32 5

] is (2ร—2) square matrix but not symmetric.

Example :

C = [1 4 64 1 06 0 3

] is (3ร—3) square and symmetric matrix by

(a12 = a21 = 4),(a13 = a31 = 6) and (a23 = a32 = 0).

3- Diagonal( main) of the matrix: are given by the elements (aij) for i = j

that is all a11 , a22 , a33 โ‹ฏ.

4- The trace of a matrix: is define as a sum of the main diagonal elements.

It is denoted by

Tr(A)=โˆ‘ aiini=1 ,

where A is an (nร—n) square.

5- Column vector (column matrix): A matrix with only one column is called

a column vector (column matrix).

For example

A = [270

] is (3ร—1) column vector.

6- Row vector (or row matrix): A matrix with only one row is called a row

vector.

For example

A =[4 6 2 1] is (1ร—4) row vector.

7- A diagonal matrix: is a square matrix with all non-diagonal elements

equal zero. That is (aij = 0) for all (i โ‰  j).

Example:

C = [1 0 00 5 00 0 3

] is (3ร—3) diagonal matrix.

8- Upper triangular matrix: is a square matrix with all elements below the

diagonal are zero, that is (aij = 0) for all i > ๐‘—.

Example:

C = [ 1 50 80 5 30 0 3

] is (3ร—3) upper triangular matrix.

9- Lower triangular matrix: is a square matrix with all elements above the

diagonal are zero, that is (aij = 0) for all j > ๐‘–.

Example :

C = [1 0 04 5 00 3 3

] is (3ร—3) Lower triangular matrix.

10- A scalar matrix : is a diagonal matrix with the same value in the

diagonal elements.

Example :

C = [5 0 00 5 00 0 5

] = 5 is (3ร—3) scalar matrix.

11- Identity (unit) matrix: is a scalar matrix with one (1) on the diagonal.

is a matrix denoted by I such that

AI = A for any matrix A.

We can denote the size in the subscript of I as ๐ผ2, ๐ผ3 and ๐ผ4 respectively.

We need the identity matrix in order to define and explain the inverse matrix in

next section.

Example :

C = [1 0 00 1 00 0 1

] = I is (3ร—3) Identity matrix.

12- Zero (null) matrix: Is the matrix all of whose elements are zero. There

is a zero matrix for every size.

For example

C = [0 0 00 0 00 0 0

] = 0 is (3ร—3) zero matrix and [0 0 00 0 0

] is (2ร—3) zero

matrix.

2.2 matrix operation

1. Equality of two matrices: Two matrices A and B are equal if the size of A

and B is the same . That is ( ๐‘Ž๐‘–๐‘— = ๐‘๐‘–๐‘—) for all i and j.

For example

If [๐‘ฅ 43 ๐‘ฆ

] = [2 43 1

] then ๐‘ฅ = 2 and ๐‘ฆ = 1 .

2. Addition of matrices: The operation of addition of two matrices is only

defined when both matrices have the same size (dimensions). If A and B are

both (m ร— n), then the sum

C =A+B

is also (m ร— n) and is defined to have each element the sum of the

corresponding elements of A and B, thus

๐‘๐‘–๐‘— = ๐‘Ž๐‘–๐‘— + ๐‘๐‘–๐‘— .

The subtraction of two matrices is similarly defined; if A and B have the

same dimensions, then the difference

C =A-B

By the same way of addition, implies that the elements of C are

๐‘๐‘–๐‘— = ๐‘Ž๐‘–๐‘— โˆ’ ๐‘๐‘–๐‘—.

For example:

[โˆ’2 42 0

] + [2 43 1

] = [โˆ’2 + 2 4 + 42 + 3 0 + 1

] = [0 85 1

]

[2 43 1

] + [3 7 24 5 1

] is not define

Basic Properties of Matrices addition

Matrix addition is commutative: A + B = B + A

Matrix addition is associative: A + (B + C) = (A + B) + C

3. Multiplication of a matrix by a number (scalar multiplication): There is also

a natural way of defining the product of a matrix with a number. Using the

matrix A= [2 43 1

] , we note that

A+A=[2 43 1

] + [2 43 1

] = [4 86 2

] =2 A.

What we see is that 2A (which is the shorthand notation for A+A) is obtained

by multiplying every element of A by 2, where a scalar is a number which is

used to multiply the entries of a matrix

In general if A is an (m ร— n) matrix with typical element (๐‘Ž๐‘–๐‘—) then the product

of a number k with A written (kA) is the product B = kA is defined to be the

matrix of the same dimensions as A whose elements are simply all scaled by

the constant k

๐‘๐‘–๐‘— = ๐‘˜ ร— ๐‘Ž๐‘–๐‘— .

For example:

3 [โˆ’2 42 0

] = [3 ร— โˆ’2 3 ร— 43 ร— 2 3 ร— 0

] = [โˆ’6 126 0

].

The distributive law holds: k(A + B) = k A + k B where k real number.

4. Matrix Multiplication: Two matrices may be multiplied together only if

they meet conditions on their dimensions that allow them to conform as

following.

Let A have dimensions (m ร— n) and B be (n ร— p), that is A has the same number

as columns as the number of rows in B, then the product

C =AB,

is defined to be an (m ร— p) matrix with elements

๐‘๐‘–๐‘— = โˆ‘ ๐‘Ž๐‘–๐‘˜๐‘๐‘˜๐‘—๐‘›๐‘˜=1 .

The element in position (๐‘–๐‘—) is the sum of the products of elements in the i-th

row of the first matrix (A) and the corresponding elements in the j-th column

of the second matrix (B).

Notice that the product AB is not defined unless the above condition is

satisfied, that is the number of columns of the first matrix must equal the

number of rows in the second.

For example:

[โˆ’2 42 0

] [3 15 0

] = [(โˆ’2 ร— 3) + (4 ร— 5) (โˆ’2 ร— 1) + (4 ร— 0)

(2 ร— 3) + (0 ร— 5) (2 ร— 1) + (0 ร— 0)] = [

14 โˆ’26 2

].

[โˆ’2 42 0

] [4 47 20 1

] is not define.

Matrix multiplication is associative, that is A (BC)=(AB) C.

Matrix multiplication Distributive over addition A(B + C) = AB + AC

(B + C) A = BA + CA

But is not commutative in general AB โ‰  BA.

Consider the

Example:

A=[1 21 2

] and B=[0 12 0

]

It is interesting to note that unlike the scalar case, the fact that AB = 0 does not

imply that either A = 0 or that B = 0.

Exercise :

Let A=[6 32 5

] and B=[2 43 1

], then find the followings

1- 3A+2B 2- -4A+B2.

2- Show that by example (๐ด โˆ’ ๐ต)2 = 0 does not imply A=B

Example : A computer monitor with (640) row pixels and (480) column can

viewed as a matrix. In order to create an image, each pixel is filled with an

appropriate colure.

The following example demonstrates the practical application of matrix

multiplication.

A local computer office shop sells three types of Laptop : Dell, Lenovo and HP. Dell

costs $260 each, Lenovo $300 each and HP $280 each. The sales of each Laptop

are as shown in Table

Sun Mon Tues Wed Thur

Dell 2 3 1 2 4

Lenovo 3 3 3 2 4

HP 2 3 4 2 4

Of course, you can solve this problem without matrices, but using matrix notation

provides a systematic way of evaluating the sales for each day.

Writing out the matrices and carrying out the matrix multiplication row by column

gives:

( 260 300 280) (2 3 1 2 43 3 3 2 42 3 4 2 4

) = (1980 2520 2280 1680 3360)

Hence the takings for Sunday are:

(2 ร— 260) + (3 ร— 300) + (2 ร— 280) = $1980.

Similarly for the other days, we have Monday $2520 Tuesday $2280, Wednesday

$1680 and Thursday $3360. The matrix on the right hand side gives the takings for

each weekday.

A software package such as MATLAB can be used for computing matrices. In fact,

MATLAB is short for โ€˜Matrix Laboratoryโ€™. It is a very useful tool which can be used

to eliminate the drudgery from lengthy calculations.

There are many mathematical software packages such as MAPLE and

MATHEMATICA, but MATLAB is particularly useful for linear algebra.

2.3 Unary Matrix operations

2.3.1 The Transpose of a Matrix

The transpose of an (mร—n) matrix A, denoted ๐ด๐‘‡, is the (nร—m) matrix define by

interchanging the rows and columns of A.

In general, the entry ๐‘Ž๐‘–๐‘— (ith row by jth column) of matrix A is transposed to ๐‘Ž๐‘—๐‘–

(jth row by ith column) in ๐ด๐‘‡.

For example, if

A=[6 32 5

] then ๐ด๐‘‡=[6 23 5

]

Properties of Transposed Matrices

1- (๐ด + ๐ต)๐‘‡ = ๐ด๐‘‡ + ๐ต๐‘‡.

2- (๐ด๐ต)๐‘‡ = ๐ต๐‘‡๐ด๐‘‡.

3- ((๐ด)๐‘‡)๐‘‡ = ๐ด.

Note: There are two important quantities associated with a square matrix. One is

the trace and the other is the determinant.

2.3.2 The Determinant of a Matrix:

The determinant of a matrix is a special number that can be calculated from or

defining only for square matrix, denoted by

det(A) or |๐ด|.

We will avoid the formal definition of the determinant (that implies notions

of permutations) for now and we will concentrate instead on its

calculation.

Finding the determinant depends on the dimension of the matrix, The

determinant of a matrix of size (n ร— n) is defined recursively in terms of

lower order determinants

((n โˆ’ 1) ร— (n โˆ’ 1)).

i. The determinant of (1ร—1) matrix or scalar matrix is the only number

in matrix. For example, det ([2])=2.

ii. The determinant of (2ร—2) matrix is defined by the relation

A=[a11 a12

a21 a22], then det (A)= a11a22 โˆ’ a12a21.

For example

๐ด = [โˆ’2 42 0

], then det (A)=-2ร—0-4ร—2=-8.

iii. The determinant of (3ร—3) matrix is defined by the relation.

A = [

a11 a12 a13

a21 a22 a23

a31 a32 a33

], then

det (A)= a11(a22 a33 โˆ’ a23 a32) โˆ’ a12(a21 a33 โˆ’ a23 a31) + a11(a21 a32 โˆ’

a22a31).

For example

๐ด = [3 2 10 1 25 4 2

],then det (A)=3(1ร—2--4ร—2)โˆ’2(0ร—2โˆ’2ร—5)+1(0ร—4โˆ’1ร—5)=18+20-5=33

We can simplify the way for finding determinant of (3ร—3) matrix as follows.

a) Rewrite the 1-st and 2-nd columns of A on the right (as โ€œColumns 4 and 5โ€).

b) Add the products along the three main diagonals that extend from upper

left to lower right.

c) Subtract the products along the three secondary diagonals that extend

from lower left to upper right.

That is if A= [

a11 a12 a13

a21 a22 a23

a31 a32 a33

], to find det (A) we rewrite A as

[

a11 a12 a13 โ‹ฎ a11 a12 a21 a22 a23 โ‹ฎ a21 a22

a31 a32 a33 โ‹ฎ a31 a32

]. Then

det (A)= (a11a22a33 )+ (a12a23a31 )+ (a13a21a32 )โˆ’ (a13a22a31 )โˆ’ (a11a23a32 )

โˆ’ (a12a21a33 ).

Note: The determinant helps us find the inverse of a matrix, tells us things about

the matrix that are useful in systems of linear equations.

To finding the determinant in general of (nร—n) matrix we need define the

following concepts first.

a/ Minor: The Minor of the element (๐‘Ž๐‘–๐‘—), is denote by ๐‘€๐‘–๐‘— , is define to be the

determinant of the low dimension matrix (sunmatrix) formed by eliminate the i-th

row and j-th column in the original matrix.

For example

Let ๐ด = [3 2 10 1 25 4 2

], then find ๐‘€22 and ๐‘€12

Solution: after eliminate the 2-nd row and 2-nd column in A we obtain

๐‘€22=det([3 15 2

])=|3 15 2

|=(3ร—2)โˆ’(1ร—5)=1.

๐‘€12=det([0 25 2

])=|0 25 2

|=(0ร—2)โˆ’(2ร—5)=โˆ’10.

b/ Cofactor: The cofactor of the element (๐‘Ž๐‘–๐‘—), is denote by ๐ถ๐‘–๐‘—, is defined by the

relation.

๐ถ๐‘–๐‘— = (โˆ’1)๐‘–+๐‘—๐‘€๐‘–๐‘—.

Note: You will notice that the cofactor and the minor always have the same

numerical value, with the possible exception of their sign came from element

position.

For example :

In example above find ๐ถ33 and ๐ถ12

Solution: ๐ถ33 = (โˆ’1)3+3๐‘€33=|3 20 1

|=(3ร—1)โˆ’(2ร—0)=3.

๐ถ12 = (โˆ’1)1+2๐‘€33=โˆ’(โˆ’10)=10.

Now we are ready to give general formula for finding determinant of (nร—n) matrix

using cofactor.

Let A be an (nร—n) matrix, then determinant of A ( by choosing i-row) given by the

relation

det (A)=โˆ‘ ๐‘Ž๐‘–๐‘—๐ถ๐‘–๐‘—๐‘›๐‘—=1 .

( by choosing j-column) given by the relation.

det (A)=โˆ‘ ๐‘Ž๐‘–๐‘—๐ถ๐‘–๐‘—๐‘›๐‘–=1 .

For example

Let ๐ด = [3 2 10 1 25 4 2

], then find det (A) using cofactor

Solution: let us choose the second row, an expansion along the first row, the

determinant would be.

Det(A)=๐‘Ž21๐ถ21+๐‘Ž22๐ถ22+๐‘Ž23๐ถ23=0(โˆ’1)2+1 |2 14 2

|+1(โˆ’1)2+2 |3 15 2

|+2

(โˆ’1)2+3 |3 25 4

|=(3ร—2โˆ’5ร—1) โˆ’2(3ร—4โˆ’5ร—2)=1โˆ’2(2)= โˆ’3.

Note: While the choice of row or column may differ, the result of the determinant

will be the same, no matter what the choice we have made.

2.3.3 Inverse of a matrix

We should now be familiar with matrix operations such as addition, subtraction

and multiplication. What about division of matrices? You cannot divide matrices.

The nearest operation to division of matrices is the inverse matrix which we discuss

in this section. We can use the inverse matrix to find solutions of linear systems.

Matrix division is not defined for all matrix, multiplication by an inverse may be

thought of as an analogous operation to the process of multiplication of a scalar

quantity by its reciprocal.

For a square n ร— n matrix A, the inverse, denoted by ๐€โˆ’1, as that matrix (if it

exists) to give the identity matrix I, satisfies the following.

๐€โˆ’1๐€ = ๐€ ๐€โˆ’1 = ๐ˆ๐‘›.

Example:

(2 11 1

) (1 โˆ’1

โˆ’1 2) = (

1 00 1

)

and so these two matrices are inverses of one another:

Note:

๐ดโˆ’1 โ‰ 1

๐ด

A matrix that is invertible is called non-singular matrix.

A matrix that is not invertible is called singular matrix.

If the inverse matrix is existing, then it is unique.

To computing the inverse of any square matrix we need define the following

concept.

Adjoint of matrix: The adjoint matrix of a square matrix A, denote by adj(A ), is

defined as the transpose of the matrix of cofactors of the elements of A, that is

Let A= [

๐‘Ž11 ๐‘Ž12 โ€ฆ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘›1 ๐‘Ž๐‘›2 โ€ฆ ๐‘Ž๐‘›๐‘›

], then adjoint of A given by relation

Adj(A)=[

๐ถ11 ๐ถ12 โ€ฆ ๐ถ1๐‘›

๐ถ21 ๐ถ22 โ€ฆ ๐ถ2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐ถ๐‘›1 ๐ถ๐‘›2 โ€ฆ ๐ถ๐‘›๐‘›

]

๐‘‡

=[

๐ถ11 ๐ถ21 โ€ฆ ๐ถ๐‘›1

๐ถ12 ๐ถ22 โ€ฆ ๐ถ๐‘›2

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐ถ1๐‘› ๐ถ2๐‘› โ€ฆ ๐ถ๐‘›๐‘›

]

For example

Let ๐ด = [โˆ’2 42 0

], then find adj(A).

Solution: adj(A)= [๐ถ11 ๐ถ12

๐ถ21 ๐ถ22 ]

๐‘‡

= [ 0 โˆ’2โˆ’4 โˆ’2

]๐‘‡

=[0 โˆ’4

โˆ’2 โˆ’2].

Then the inverse of a square matrix A is found from the determinant

and the adjoint of A, by the relation.

๐ดโˆ’1 =๐‘Ž๐‘‘๐‘—(๐ด)

det (๐ด)=

1

det(๐ด)๐‘Ž๐‘‘๐‘—(๐ด).

Notice that the condition for the inverse to be exist, that is for A to be

non-singular, is that det (A) โ‰ 0.

Example: Not every square matrix has an inverse. For instance

1- ๐ด = (3 26 4

) has no inverse because det(A)=0

2- ๐ต = (3 3 12 2 0

) has no inverse because it is not square matrix.

Theorem: If A is an invertible matrix, then its inverse is unique.

For example

Let ๐ด = [โˆ’2 42 0

], then find ๐ดโˆ’1 if it is exist

Solution: First w need find det(A) =0x-2โˆ’4x2=โˆ’8โ‰ 0 so it is exist.

๐ดโˆ’1 =1

det(๐ด)๐‘Ž๐‘‘๐‘—(๐ด)=

1

โˆ’8[

0 โˆ’4โˆ’2 โˆ’2

]= [0

โˆ’4

โˆ’8โˆ’2

โˆ’8

โˆ’2

โˆ’8

]=[0

1

21

4

1

4

]

We can cheek ๐ด๐ดโˆ’1 = [โˆ’2 42 0

] [0

1

21

4

1

4

]=[1 00 1

]=๐ผ2.

Exercise:

If ๐ด = [2 โˆ’3

โˆ’4 1] and B=[

3 2 10 4 51 0 6

] , then find ๐ดโˆ’1 and ๐ตโˆ’1 if exists.

Properties of Transposed Matrices

Let A and B be invertible matrices, then AB is invertible and

(๐ด๐ต)โˆ’1 = ๐ตโˆ’1๐ดโˆ’1

(๐ดโˆ’1)โˆ’1 = ๐ด

(๐ด๐‘‡)โˆ’1 = (๐ดโˆ’1)๐‘‡

Suppose we have a general linear system of m equations with n unknowns

labelled

Chapter 3: System of linear equations and Matrices

3.1 The Matrix Representation of a System of Linear Equations:

The study and solution of systems of simultaneous linear equations is the main

motivation behind the development of the theory of linear algebra and of matrix

operations.

The system of m linear equation in n variables๐‘ฅ1, ๐‘ฅ2, ๐‘ฅ3,โ€ฆ โ€ฆ, ๐‘ฅ๐‘› is of the form

๐‘Ž11๐‘ฅ1+๐‘Ž12๐‘ฅ2 + โ‹ฏ โ‹ฏ + ๐‘Ž1๐‘›๐‘ฅ๐‘› = ๐‘1

๐‘Ž11๐‘ฅ1+๐‘Ž12๐‘ฅ2 + โ‹ฏ โ‹ฏ + ๐‘Ž1๐‘›๐‘ฅ๐‘› = ๐‘1

โ‹ฎ โ‹ฎ + โ‹ฏ โ‹ฏ + โ‹ฎ = โ‹ฎ

๐‘Ž๐‘š1๐‘ฅ1+๐‘Ž๐‘š2๐‘ฅ2 + โ‹ฏ โ‹ฏ + ๐‘Ž๐‘š๐‘›๐‘ฅ๐‘› = ๐‘๐‘š

Can be written as matrix equation by ๐ด๐‘‹ = ๐‘ or in full

[

๐‘Ž11 ๐‘Ž12 โ€ฆ ๐‘Ž1๐‘›

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘›

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 ๐‘Ž๐‘š๐‘›

] [

๐‘ฅ1

๐‘ฅ2โ‹ฎโ‹ฎ

๐‘ฅ๐‘›

] = [

๐‘1

๐‘2โ‹ฎโ‹ฎ

๐‘๐‘š

]

We called A the matrix of coefficient, b the column vector of constant

and X the column vector of unknown variables. Also

[

๐‘Ž11 ๐‘Ž12 โ€ฆ ๐‘Ž1๐‘› โ‹ฎ ๐‘1

๐‘Ž21 ๐‘Ž22 โ€ฆ ๐‘Ž2๐‘› โ‹ฎ ๐‘2

โ‹ฎ โ‹ฎ โ‹ฑ โ‹ฎ โ‹ฎ โ‹ฎ๐‘Ž๐‘š1 ๐‘Ž๐‘š2 ๐‘Ž๐‘š๐‘› โ‹ฎ ๐‘๐‘š

]

Is called augmented matrix.

3.2 Direct method for solving linear systems:

1- Inverse method: The importance of the inverse matrix can be

seen from the solution of a set of algebraic linear equations such

as

๐ด๐‘‹ = ๐‘

If the inverse ๐ดโˆ’1 exists then pre-multiplying both sides gives,

๐ดโˆ’1๐ด๐‘‹ = ๐ดโˆ’1๐‘

๐ผ๐‘‹ = ๐ดโˆ’1๐‘.

Since pre-multiplying a column vector of length n by the n-th order

identity matrix I does not affect its value, this process gives an explicit

solution to the set of equations.

๐‘‹ = ๐ดโˆ’1๐‘.

Example: Solve the given linear system using inverse method.

๐‘ฅ1 + 2๐‘ฅ2 = 4

3๐‘ฅ1 โˆ’ 5๐‘ฅ2 = 1

Solution : first we need to write the system as matrix equation, so

A=[1 23 โˆ’5

], X=[๐‘ฅ1

๐‘ฅ2] and b= [

41

] .

Then we have

๐ด๐‘‹ = ๐‘

Hence we need find ๐ดโˆ’1 =1

det(๐ด)๐‘Ž๐‘‘๐‘—(๐ด)=

1

โˆ’5โˆ’6[

โˆ’5 โˆ’2โˆ’3 1

]=[

โˆ’5

โˆ’11

โˆ’2

โˆ’11โˆ’3

โˆ’11

1

11

]

Then X is given by X=๐ดโˆ’1๐‘=[

โˆ’5

โˆ’11

โˆ’2

โˆ’11โˆ’3

โˆ’11

1

11

] [41

]

X=[๐‘ฅ1

๐‘ฅ2] = [

2

1].

Therefore x1 =2 and ๐‘ฅ2 =1 is the solution of the linear equations.

Exercise Solve the following linear systems using inverse method.

a/ 5๐‘ฅ1 + ๐‘ฅ2 = 13 b/ 3๐‘ฅ1 + 2๐‘ฅ2 = โˆ’2

3๐‘ฅ1 + 2๐‘ฅ2 = 5 ๐‘ฅ1 + 4๐‘ฅ2 = 6

2- Cramerโ€™s Method: Cramerโ€™s method is a convenient method for

manually solving low-order non-homogeneous sets of linear

equations. If the equations are written in matrix form

๐ด๐‘‹ = ๐‘.

Then the i-th element of the vector X may be found directly from

a ratio of determinants as

๐‘ฅ๐‘– =det (๐ด๐‘–)

det (๐ด) ,

where ๐ด๐‘– is the matrix formed by replacing the i-th column of A

with the column vector b.

Example: Solve the given linear system using Cramer method.

3๐‘ฅ1 + 4๐‘ฅ2 = 4

2๐‘ฅ1 + 3๐‘ฅ2 = 5

Solution : first we need to write the system as matrix equation, so

A=[3 42 3

], X=[๐‘ฅ1

๐‘ฅ2] and b= [

45

] .

Then we have ๐‘ฅ1 =det (๐ด1)

det (๐ด)=

det ([4 45 3

])

det ([3 42 3

])=

12โˆ’20

9โˆ’8= โˆ’8

๐‘ฅ2 =det (๐ด2)

det (๐ด)=

det ([3 42 5

])

det ([3 42 3

])=

15โˆ’8

9โˆ’8= 7.

3.3 Elementary row operations (ERO) and their corresponding matrices

Recall from Algebra, that equivalent equations have the same solution set For example : To solve 2๐‘ฅ + 3 = 5

2๐‘ฅ = 5 โˆ’ 3 = 2

๐‘ฅ =2

2 =1

To solve the first equation, we write a sequence of equivalent equations until we

arrive at an equation whose solution set is obvious.

The steps of subtract 3 to both sides of the first equation and of dividing both

sides of the second equation by 2 are like โ€œlegal chess movesโ€ that allowed us to

maintain equivalence (i.e., to preserve the solution set).

Similarly, equivalent systems have the same solution set.

Then the Elementary Row Operations (ERO) represent the legal moves that allow

us to write a sequence of row-equivalent matrices (corresponding to equivalent

systems) until we obtain one whose corresponding solution set is easy to find.

There are three types of ERO:

1) Row Reordering: We can reorder the rows of an augmented matrix in any

order.

Note: Do not reorder columns in the coefficient matrix, that will change the

order of the corresponding variables.

Example : Consider the system:

3๐‘ฅ1 + 4๐‘ฅ2 = 4

2๐‘ฅ1 + 3๐‘ฅ2 = 5

If we switch (i.e., interchange) the two equations, then the solution set is not disturbed:

2๐‘ฅ1 + 3๐‘ฅ2 = 5

3๐‘ฅ1 + 4๐‘ฅ2 = 4

This suggests that, when we solve a system using augmented matrices (We can switch any two rows) as

๐‘…1

๐‘…2 [

3 4 โ‹ฎ2 3 โ‹ฎ

45

]

Here, we switch rows ๐‘…1 and ๐‘…2 , which we denote by: ๐‘…1 โ‡” ๐‘…2

new ๐‘…1

new ๐‘…2 [

2 3 โ‹ฎ3 4 โ‹ฎ

54

]

2) Row Rescaling: We can multiply (or divide) โ€œthroughโ€ a row by any nonzero

constant.

Example : Consider the system:

2๐‘ฅ1 + 4๐‘ฅ2 = 4

2๐‘ฅ1 + 3๐‘ฅ2 = 5

If we divide โ€œthroughโ€ both sides of the first equation by 2, then we obtain an equivalent equation and, overall, an equivalent system:

๐‘ฅ1 + 2๐‘ฅ2 = 2

2๐‘ฅ1 + 3๐‘ฅ2 = 5

This suggests that, when we solve a system using augmented matrices (We can multiply (or divide) โ€œthroughโ€ a row by any nonzero constant.) as

๐‘…1

๐‘…2 [

2 4 โ‹ฎ2 3 โ‹ฎ

45

]

Here, we multiply through ๐‘…1 by 2, which we denote by: 1

2๐‘…1

new ๐‘…1

๐‘…2 [

1 2 โ‹ฎ2 3 โ‹ฎ

25

]

2) Row Replacement: We can add a multiple of one row to another row.

Example : Consider the system:

2๐‘ฅ1 + 4๐‘ฅ2 = 4

2๐‘ฅ1 + 3๐‘ฅ2 = 5

If we multiply the first equation by 2 and add with second equation, then we

obtain an equivalent equation and, overall, an equivalent system:

2๐‘ฅ1 + 4๐‘ฅ2 = 4

6๐‘ฅ1 + 11๐‘ฅ2 = 13

This suggests that, when we solve a system using augmented matrices we have

๐‘…1

๐‘…2 [

2 4 โ‹ฎ2 3 โ‹ฎ

45

]

Here, we multiply through ๐‘…1 by 2 and add with ๐‘…2which we denote by: 2๐‘…1 + ๐‘…2

๐‘…1

new ๐‘…2 [

2 4 โ‹ฎ6 11 โ‹ฎ

4

13]

3- GAUSSIAN ELIMINATION (WITH BACK-SUBSTITUTION)method:

This is another method for solving systems of linear equations. Basic idea of

Gaussian elimination apply certain operations to the matrix that do not change

the solution, in order to bring the matrix into a from where we can immediately

โ€œseeโ€ the solution.

Steps : for solving any square system of equation using Gaussian

elimination method

1. Write the augmented matrix of the system.

2. Use (ERO) to write a sequence of row-equivalent matrices until you get

the upper- triangular matrix.

3. Then use backward substitution to get the solution of the given system.

Example : Solve the linear system using Gaussian elimination:

๐‘ฅ1 โˆ’ 2๐‘ฅ2 = 4

4๐‘ฅ1 โˆ’ ๐‘ฅ2 = 5

Solution : First we wish to eliminate only ๐‘Ž21, the augmented matrix is

given by

๐‘…1

๐‘…2 [

1 โˆ’2 โ‹ฎ4 โˆ’1 โ‹ฎ

45

]

Then use (ERO) by โˆ’4๐‘…1 + ๐‘…2, we obtain

๐‘…1

new ๐‘…2 [

1 โˆ’2 โ‹ฎ0 7 โ‹ฎ

4

โˆ’11]

Obviously, the original set of equations has been transformed to an upper-

triangular form.

Now we express the set in algebraic form yields:

๐‘ฅ1 โˆ’ 2๐‘ฅ2 = 4

7๐‘ฅ2 = โˆ’11.

Using backward substitution to give.

7๐‘ฅ2 = โˆ’11 gives ๐‘ฅ2 =โˆ’11

7

๐‘ฅ1 = 4 + 2 (โˆ’11

7) =

6

7

Exercise: Solve the linear system using Gaussian elimination:

๐‘ฅ1 + 2๐‘ฅ2 = 3

โˆ’๐‘ฅ1 โˆ’ 2๐‘ฅ3 = โˆ’5

โˆ’3๐‘ฅ1 โˆ’ 5๐‘ฅ2 + ๐‘ฅ3 = โˆ’4

Example: Solve the linear system using Gaussian elimination:

2๐‘ฅ2 โˆ’ ๐‘ฅ3 = 1

3๐‘ฅ1 โˆ’๐‘ฅ2 + 2๐‘ฅ3 = 4

๐‘ฅ1 + 3๐‘ฅ2 โˆ’ 5๐‘ฅ3 = 1

Solution: The augmented matrix form of the system given by

[0 2 โˆ’1 โ‹ฎ 13 โˆ’1 2 โ‹ฎ 41 3 โˆ’5 โ‹ฎ 1

]

Note: To solve this system, the Gaussian elimination method will fail immediately because the element in the first row on the leading diagonal, (the pivot) is zero. Thus, it is impossible to divide that row by the pivot value. Clearly this difficulty can be overcome by rearranging the order of the row.

For example, we making the first row the third, we obtain

[1 3 โˆ’5 โ‹ฎ 13 โˆ’1 2 โ‹ฎ 40 2 โˆ’1 โ‹ฎ 1

]

Now we can use the usual elimination process. The first elimination step is to

eliminate the element ๐‘Ž21from the second row by adding a โˆ’3 multiple of row one (โˆ’3๐‘…1 + ๐‘…2), which give

[1 3 โˆ’5 โ‹ฎ 10 โˆ’10 17 โ‹ฎ 10 2 โˆ’1 โ‹ฎ 1

]

We finish with first elimination step. Since the element ๐‘Ž31 is already zero .

The second elimination step is to eliminate the element ๐‘Ž32from the third row by

adding a 2

10 multiple of row two (

2

10๐‘…2 + ๐‘…3), which give

[

1 3 โˆ’5 โ‹ฎ 10 โˆ’10 17 โ‹ฎ 1

0 012

5 โ‹ฎ

6

5

]

Obviously, the original set of equations has been transformed to an upper-

triangular form.

Now we express the set in algebraic form yields:

๐‘ฅ1 + 3๐‘ฅ2 โˆ’ 5๐‘ฅ3 = 1

โˆ’10๐‘ฅ2 + 17๐‘ฅ3 = 1

12

5๐‘ฅ3 =

6

5

Using backward substitution to give.

12

5๐‘ฅ3 =

6

5 gives ๐‘ฅ3=

1

2

โˆ’10๐‘ฅ2 + 17(1

2)= 1 gives ๐‘ฅ2=

3

4

๐‘ฅ1 + 3 (3

4) โˆ’ 5 (

1

2 ) = 1 gives ๐‘ฅ1=

5

4

Example: Solve the linear system using Gaussian elimination:

2๐‘ฅ1 + 2๐‘ฅ2 โˆ’ 4๐‘ฅ3 = 0

2๐‘ฅ1 +2๐‘ฅ2โˆ’๐‘ฅ3 = 1

3๐‘ฅ1 + 2๐‘ฅ2 โˆ’ 3๐‘ฅ3 = 3

Solution : The augmented matrix form of the system given by

[2 2 โˆ’4 โ‹ฎ 02 2 โˆ’1 โ‹ฎ 13 2 โˆ’3 โ‹ฎ 3

]

The first elimination step is to eliminate the element ๐‘Ž21from the second row by

adding a โˆ’1 multiple of row one (โˆ’๐‘…1 + ๐‘…2) and the element ๐‘Ž31from the

thired row by adding a โˆ’3

2 multiple of row one (โˆ’

3

2 ๐‘…1 + ๐‘…3), which give

[2 2 โˆ’4 โ‹ฎ 00 0 3 โ‹ฎ 10 โˆ’1 3 โ‹ฎ 3

]

We finish with first elimination step.

To start second elimination step is to eliminate the element ๐‘Ž22from the second row which is zero ( is called second pivot element), the Gaussian elimination method cannot continue in its present form .

Therefore, we interchange row two and row three to obtain

[2 2 โˆ’4 โ‹ฎ 00 โˆ’1 3 โ‹ฎ 30 0 3 โ‹ฎ 1

]

We finish with the second elimination step. Since the element ๐‘Ž32 is already zero .

Then obviously, the original set of equations has been transformed to an upper-

triangular form. Now we express the set in algebraic form yields:

2๐‘ฅ1 + 2๐‘ฅ2 โˆ’ 4๐‘ฅ3 = 0

โˆ’๐‘ฅ2 + 3๐‘ฅ3 = 3

3๐‘ฅ3 = 1

Using backward substitution to give.

3๐‘ฅ3 = 1 gives ๐‘ฅ3=1

3

โˆ’๐‘ฅ2 + 3(1

3)= 3 gives ๐‘ฅ2=โˆ’2

2๐‘ฅ1 + 2(โˆ’2) โˆ’ 4 (1

3 ) = 0 gives ๐‘ฅ1=

8

3

Pivoting strategies : In the previous part we discussed Gaussian elimination and Gaussian elimination was applied to a problem with no pivotal elements zero.

However, the method did not work

if the first coefficient of the first equation or

if a diagonal coefficient become zero in the process of the solution because they are used as denominator in the forward elimination.

Then pivoting is used to change sequential order of the equation for two purposes

1- To prevent diagonal coefficients form becoming zero. 2- To make each diagonal coefficient larger in value (magnitude) than any

other coefficient below it. That is to decrease the round-off errors.

1- Partial Pivoting(or row Pivoting) the basic approach is to use the largest ( in absolute value ) element on or below the diagonal in the column of current interest as the pivotal element for elimination in the rest of that column.

One immediate effort of this will be to force all the multiples used to be not grater than (1) in absolute.

Example : Solve the linear system using Gaussian elimination with partial pivoting:

2๐‘ฅ1 + 2๐‘ฅ2 โˆ’ 2๐‘ฅ3 = 8

โˆ’4๐‘ฅ1 โˆ’2๐‘ฅ2+2๐‘ฅ3 = โˆ’14

โˆ’2๐‘ฅ1 + 3๐‘ฅ2 + 9๐‘ฅ3 = 9

Solution : For the first elimination step, since โˆ’4 is the largest absolute coefficient

of first variable ๐‘ฅ1. Then we need to interchange, the first row and the second

row, give us

โˆ’4๐‘ฅ1 โˆ’2๐‘ฅ2+2๐‘ฅ3 = โˆ’14

2๐‘ฅ1 + 2๐‘ฅ2 โˆ’ 2๐‘ฅ3 = 8

โˆ’2๐‘ฅ1 + 3๐‘ฅ2 + 9๐‘ฅ3 = 9

The first elimination step is to eliminate the element ๐‘Ž21from the second row by

adding a 2

4 multiple of row one (

2

4๐‘…1 + ๐‘…2) and the element ๐‘Ž31from the thired

row by adding a โˆ’2

4 multiple of row one (โˆ’

2

4 ๐‘…1 + ๐‘…3), which give

โˆ’4๐‘ฅ1 โˆ’2๐‘ฅ2+2๐‘ฅ3 = โˆ’14

๐‘ฅ2 โˆ’ 2๐‘ฅ3 = 1

4๐‘ฅ2 + 8๐‘ฅ3 = 16

We finish with first elimination step. For second elimination step (4) is the largest absolute coefficient of the second variablex2. Then we need to interchange, the second row and the third row, give us

โˆ’4๐‘ฅ1 โˆ’2๐‘ฅ2+2๐‘ฅ3 = โˆ’14

4๐‘ฅ2 + 8๐‘ฅ3 = 16

๐‘ฅ2 โˆ’ ๐‘ฅ3 = 1

Eliminate the second variable ๐‘ฅ2 (element ๐‘Ž32) from the third row by adding a โˆ’1

4

multiple of row two ( โˆ’1

4๐‘…2 + ๐‘…3) , which give

โˆ’4๐‘ฅ1 โˆ’2๐‘ฅ2+2๐‘ฅ3 = โˆ’14

4๐‘ฅ2 + 8๐‘ฅ3 = 16

โˆ’3๐‘ฅ3 = โˆ’3

Then obviously, the original set of equations has been transformed to an upper-

triangular form. Using backward substitution give.

3๐‘ฅ3 = โˆ’3 Gives ๐‘ฅ3=1, ๐‘ฅ2=2 and ๐‘ฅ1=3.

2- Total Pivoting : In the case total pivoting ( or complete pivoting ), we search

for the largest number( in absolute value ) in the entire array instead of just

in the first column and this number is the pivot, This means that we shall

probably need to interchange the column as well as rows.

Example : Solve the linear system using Gaussian elimination with total pivoting:

2๐‘ฅ1 + 2๐‘ฅ2 โˆ’ 2๐‘ฅ3 = 8

โˆ’4๐‘ฅ1 โˆ’2๐‘ฅ2+2๐‘ฅ3 = โˆ’14

โˆ’2๐‘ฅ1 + 3๐‘ฅ2 + 9๐‘ฅ3 = 9

Solution : For the first elimination step, since 9 is the largest absolute coefficient of

first variable ๐‘ฅ3 in the given system. Then we need to interchange, the first row

and the third row as well as the first column and the third column, give us

9๐‘ฅ3 +3๐‘ฅ2โˆ’2๐‘ฅ1 = 9

2๐‘ฅ3 โˆ’ 2๐‘ฅ2 โˆ’ 4๐‘ฅ1 = โˆ’14

โˆ’2๐‘ฅ3 + 2๐‘ฅ2 + 2๐‘ฅ1 = 8

The first elimination step is to eliminate the third variable ๐‘ฅ3 from the second row

by adding a โˆ’2

9 multiple of row one ( โˆ’

2

9 ๐‘…1 + ๐‘…2) and the third row by adding a

2

9 multiple of row one (

2

9 ๐‘…1 + ๐‘…3), which give

9๐‘ฅ3 +3๐‘ฅ2โˆ’2๐‘ฅ1 = 9

โˆ’8

3๐‘ฅ2 โˆ’

32

9๐‘ฅ1 = โˆ’16

8

3๐‘ฅ2 +

14

9๐‘ฅ1 = 10

We finish with first elimination step. For second elimination step (โˆ’32

9) is the

largest absolute coefficient of the second variable x1. Then we need to interchange, the second row and the third row as well as the second column and the third column, give us

9๐‘ฅ3 โˆ’2๐‘ฅ1 + 3๐‘ฅ2 = 9

โˆ’32

9๐‘ฅ1 โˆ’

8

3๐‘ฅ2 = โˆ’16

14

9๐‘ฅ1 +

8

3๐‘ฅ2 = 10

Eliminate the first variable ๐‘ฅ1 from the third row by adding โˆ’7

16 multiple of row

two ( โˆ’7

16๐‘…2 + ๐‘…3) , which give

9๐‘ฅ3 โˆ’2๐‘ฅ1 + 3๐‘ฅ2 = 9

โˆ’32

9๐‘ฅ1 โˆ’

8

3๐‘ฅ2 = โˆ’16

3

2๐‘ฅ2 = 10

Then obviously, the original set of equations has been transformed to an upper-

triangular form. Using backward substitution give

3

2๐‘ฅ2 = 10 Gives ๐‘ฅ2=2, ๐‘ฅ1=3 and ๐‘ฅ3=1.

Ex:

1- Solve the linear system using Gaussian elimination with partial pivoting.

๐‘ฅ1 โˆ’ ๐‘ฅ2 + 3๐‘ฅ3 = 13

4๐‘ฅ1 โˆ’ 2๐‘ฅ2 + ๐‘ฅ3 = 15

โˆ’ 3๐‘ฅ1 โˆ’ ๐‘ฅ2 + 4๐‘ฅ3 = 8

๐‘ฅ1 = 2 , ๐‘ฅ2 = โˆ’2, ๐‘ฅ3=3.

2- Solve the linear system using Gaussian elimination with total pivoting.

๐‘ฅ1 + ๐‘ฅ2 โˆ’ ๐‘ฅ3 = โˆ’3

2๐‘ฅ1 โˆ’ 3๐‘ฅ2 + 4๐‘ฅ3 = 23

โˆ’ 3๐‘ฅ1 + ๐‘ฅ2 โˆ’ ๐‘ฅ3 = โˆ’15

๐‘ฅ1 = 2 , ๐‘ฅ2 = โˆ’1, ๐‘ฅ3=4.

Write your solution process as augmented matrix.

4- GAUSSIAN โ€“ Jordan method: This method is a modification of the

Gaussian elimination method. The Gauss-Jordan method, however, is

inefficient for practical calculation, but is often useful for theoretical

purposes. The basis of this method is to convert the given matrix into

diagonal form. The forward elimination of the Gauss-Jordan method is

identical to that of the Gaussian elimination method.

However, Gauss-Jordan method uses backward elimination rather than

backward substitution. In the Gauss-Jordan method the forward elimination

and backward elimination not need to separate.

This is possible because a pivot element can be used to eliminate the

coefficient not only in below but also above at same time. If this approach is

taken, the form of this coefficient matrix becomes diagonal.

Example: Solve the linear system using GAUSSIAN โ€“ Jordan method:

๐‘ฅ1 + 2๐‘ฅ2 = 3

โˆ’๐‘ฅ1 โˆ’2๐‘ฅ3 = โˆ’5

โˆ’3๐‘ฅ1 โˆ’ 5๐‘ฅ2 + ๐‘ฅ3 = โˆ’4

Solution : The augmented matrix form of the system given by

[1 2 0 โ‹ฎ 3

โˆ’1 0 โˆ’2 โ‹ฎ โˆ’5โˆ’3 โˆ’5 1 โ‹ฎ โˆ’4

]

The first elimination step is to eliminate the element ๐‘Ž21 by adding row one and

row two (๐‘…1 + ๐‘…2) and the element ๐‘Ž31 by adding a 3multiple of row one and row three (3๐‘…1 + ๐‘…3), which give

[1 2 0 โ‹ฎ 30 2 โˆ’2 โ‹ฎ โˆ’20 1 1 โ‹ฎ 5

]

We finish with first elimination step. The second row is now divided by (2) to give

[1 2 0 โ‹ฎ 30 1 โˆ’1 โ‹ฎ โˆ’10 1 1 โ‹ฎ 5

]

To start second elimination step is to eliminate the element ๐‘Ž12 by adding

(โˆ’2) multiple row two and row one (โˆ’2๐‘…2 + ๐‘…1) and the element ๐‘Ž32 by

subtract row two and row three (๐‘…1โˆ’๐‘…3), which give

[1 0 2 โ‹ฎ 50 1 โˆ’1 โ‹ฎ โˆ’10 0 2 โ‹ฎ 6

]

The third row is now divided by (2) to give

[1 0 2 โ‹ฎ 50 1 โˆ’1 โ‹ฎ โˆ’10 0 1 โ‹ฎ 3

]

The third elimination step is to eliminate the element ๐‘Ž23 by adding row three

and row two (๐‘…3 + ๐‘…2) and the element ๐‘Ž13 by adding (โˆ’2) multiple of row three and row one (โˆ’2๐‘…3+๐‘…1), which give .

[1 0 0 โ‹ฎ โˆ’10 1 0 โ‹ฎ 20 0 1 โ‹ฎ 3

]

Obviously, the original set of equations has been transformed to an upper-

triangular form yields:

๐‘ฅ1=โˆ’1 , ๐‘ฅ2=2 and ๐‘ฅ3=3.

Ex: Solve the linear system using Gaussian โ€“ Jordan method

๐‘ฅ1 + ๐‘ฅ2 + ๐‘ฅ3 = โˆ’3

2๐‘ฅ1 + 3๐‘ฅ2 + 7๐‘ฅ3 = 0

๐‘ฅ1 + 3๐‘ฅ2 โˆ’ 2๐‘ฅ3 = 17

๐‘ฅ1 = 1 , ๐‘ฅ2 = 4, ๐‘ฅ3=-2.

Ex:

1- Ali and Layla both entered a quiz. The quiz had twenty questions and points

were allocated as follows:

โ€ข x points were added for each correctly answered question.

โ€ข y points were deducted for each incorrect (or unanswered) question.

Ali got 15 questions correct and scored 65 points.

Layla got 11 questions correct and scored 37 points.

Use matrices to find the value of x and y.

2- A store sells flash memory and CD's. All the flash memory have the same price

and all the CD's have the same price.

Dana and Sara both shopped at the store.

Dana bought 5 flash memories and 3 CD's and paid altogether $90

Sara bought 2 flash memories and 8 CD's and paid altogether $138

Use matrices to find the cost of one flash memory and one CD.