- 66 Views
- Uploaded on
- Presentation posted in: General

n equations in n unknowns

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

n equations in n unknowns

1 equation: 3 x + 4y + 16z = 12

many solutions (x=0, y=3, z=0 / x=4, y=0, z=0 / etc. )

2 equations: 3 x + 4y + 16z = 12

6x - 17y - 23z = -168

solutions become limited...

3 equations: 3 x + 4y + 16z = 12

6x - 17y - 23z = -168

x + 42y + 101 z = 140

one solution only: x = 62.0129 y = 70.2452 z = -28.4387

- usually represent a table, or a data relationship
- or - referring to C++ - correlated arrays
3 x + 4y + 16z = 12 3 4 16 12

6x - 17y - 23z = -168 6 -17 -23 -168

x + 42y + 101 z = 140 1 42 101 140

3 equations in 3 unknowns, represented by matrices

1) x + y − z = 4

2) x − 2y + 3z = −6

3) 2x + 3y + z = 7

1 1 -1 x 4

1 -2 3 * y = -6

2 3 1 z 7

A = [1 1 -1; 1 -2 3; 2 3 1] % called coefficient matrix

[ x; y; z ] % called the variables matrix

C = [ 4; -6; 7 ] % called the constants matrix

- a square matrix with 1s in the diagonal and 0s everywhere else
I = eye(3) % yields a 3x3 Identity Matrix

Any matrix times an appropriately sized identity matrix yields itself

3x2 2x2 3x2

23 45 1 0 23 45

17 22 * 0 1 = 17 22

1 32 1 32

Size of ID matrix: SQUARE, dictated by COLUMNS of the multiplying matrix

- A matrix multiplied by it's Inverse yields the identity matrix
- Ainv * A = Identity
- "Singular" matrices have no Inverse

A

1) x + y − z = 4

2) x − 2y + 3z = −6

3) 2x + 3y + z = 7

multiply both sides by AInv:

1 1 -1 x 4

1 -2 3 * y = -6

2 3 1 z 7

x 4

AI * A * y = AI * -6

z 7

find AInv, and you can solve for x, y, z

The admission fee at a small fair is $1.50 for children and $4.00 for adults. On a certain day, 2200 people enter the fair and $5050 is collected. How many children and how many adults?

Lets call adults x and children y

2200 people attend the fair x + y = 2200

Child admission fee is $1.50, Adult admission fee is $4.00

The total amount collected is $5050.00: 4x + 1.5y = 5050

non-matrix way:

Take the first equation and set it equal to x(subtract y from both sides x + y - y = 2200 - y

x = 2200 - y

Now since we have shown that x equals 2200-y we can substitute that for x in the

second equation and solve for y

4x + 1.5y = 5050

4(2200-y) + 1.5y = 5050

8800 - 4y + 1.5y = 5050

combine like terms: 8800 - 2.5y = 5050

subtract 8800 from both sides: 8800 - 8800 - 2.5y = 5050 - 8800

we have: -2.5y = -3750

divide both sides by -2.5: -2.5y/-2.5 = -3750/-2.5

y = 1500

Answer: 1500 children attended the fair

Now use this answer to find x

Take the first equation and substitute y with 1500

x + y = 2200

x + 1500 = 2200

x + 1500 - 1500 = 2200 - 1500

x = 700

Answer: 700 adults attended the fair

x + y = 2200 1 1 x = 2200

4x + 1.5y = 5050 4 1.5 y 5050

find the Inverse of A: -.6 .4

1.6 -.4

-.6 .4 1 1 x = -.6 .4 2200

1.6 -.4 4 1.5 y 1.6 -.4 5050

x 700

y = 1500

- matrix multiplication (and its vector equivalent, the "dot product") is essentially a transformation which combines properties.
- "dividing by a matrix" is only possible by multiplying by its inverse (i.e. dividing by 5, is the same as multiplying by .20, or 1/5, which is the inverse of 5).
- element-by-element multiplication is called the Hadamard product, (in MATLAB " .* ") and is used in compressing JPEGs, where display properties are represented by a matrix, .

Use matrices in MATLAB to solve the following problem. You must display all matrices and the resultant 3-digit number as output.

- Consider a three-digit number given as “xyz”. For example, if the number were 123, x would be 1, y would be 2, and z would be 3. Remember that the number represented by xyz is actually (x*100) + (y*10) + z ...
- If you add up the digits of a 3-digit number, the sum is 11.If the digits are all reversed, the new number is 46 more than 5x the old number.The hundreds digit plus twice the tens digit is equal to the units digit.
- What is the number?

If you add up the digits of a 3-digit number, the sum is 11.

x + y + z = 11

If the digits are reversed, the new number is 46 more than five times the old number.

note: xyz is really 100x + 10y + z

100z + 10y + x = 5(100x + 10y + z) + 46

100z + 10y + x = 500x + 50y + 5z +46

(100z - 5z) + (10y -50y) + (x - 500x) = 46

95z -40y -499x = 46

-499x -40y +95z = 46

The hundreds digit plus twice the tens digit is equal to the units digit.

x + 2y = z

1x + 2y -1z = 0

x + y + z = 11

-499x -40y +95z = 46

1x + 2y -1z = 0

1 1 1 x 11

-499 -40 95 * y = 46

1 2 -1 z 0

A = [ 1 1 1 ; -499 -40 95; 1 2 -1]

Z = [11; 46; 0]

A_I = inv (A)

Ans = A_I * Z

x = Ans(1,:)

y = Ans(2,:)

z = Ans(3, :)