Anda di halaman 1dari 8

# Faculty of Computing,

Environment

## Data Analysis UG1

Vectors and Matrices
1 - Vectors
1.1 Introduction
Many quantities occur in computing which require both a magnitude and a direction. These quantities
are called vector quantities because they are defined by their magnitude and direction, as opposed to
scalar quantities which need only a magnitude eg volume, temperature, area, length.

1.2 Notation
Vectors are usually denoted by a lower case letter that is either in bold type (as in text books) or
underlined.

## 1.2.a Components of a vector in terms of a unit vector

y i is defined as the unit vector in the direction Ox

O x
i

## Data Analysis UG1 1

Example 1.2.1

2 a The vector a = 3i + 2j

O
1 2 3

## 1.2.b Cartesian form

Usually written as a column matrix

Example 1.2.2

3
a=
2

1.3 Modulus
The modulus of a vector is the length and is found by Pythagoras theorem.
It is denoted thus:|a|
|a| = 32 22 9 4 13

## 1.4 Addition of vectors

The sum of two vectors is defined as the single or resultant vector c

a+b=c

c
b

The resultant can also be obtained by adding the horizontal components and adding the vertical
components

Example 1.4.1

## Data Analysis UG1 2

1.5 Subtraction of vectors
Example 1.5.1

a
b
a b

Example 1.6.1

## Multiply each component by the scalar quantity

(These are similar to operations on complex numbers)

As with all vectors direction is important - remember that the vector from A to B is not the
same as the vector from B to A.

## Data Analysis UG1 3

2 - Matrices

Introduction
Matrices are a convenient notation which enables us to handle large quantities of information and systems of
equations more effectively. For instance, these model the way in which data is stored in a two dimensional array in
computer programming.

## 2. Matrices and Determinants

2.1 Matrix
A rectangular array of numbers whose positions are relevant. Using matrices allows us to manipulate and store
information more easily.

## 2.1.1 General Matrix Notation

a 11 a 12 a 13 .......... a 1n
a 21 a 22 a 23 .......... a 2n
a 31 a 32 a 33 .......... a 3n
A=
. . . . .
. . . . .
a m1 a m2 a m3 .......... a m n
MxN

## 2.1.2 Column Matrix Row Matrix

b1
b2
B= . C= c1 c2 c 3 .......... c n
.
bm
Mx1 1xN

## ai j for a 2 Dimensional matrix A where i = 1, 2, 3 .. m (row number) and

j = 1, 2, 3 .. n (column number)

## Data Analysis UG1 4

2.2 Matrix Algebra
It is possible to perform operations between matrices. The more useful operations are defined (kept as similar to
operations between Real numbers as possible)

2.2.1 Equality

4 3 4 3
A= B= Then A = B
1 2 1 2

5 2 5 1
C= D= Then C D
3 4 3 4

2 3 1 0 3 3
1 4 + 0 -4 = 1 0
1 5 1 3 0 8
A + B = C

## 2.2.3 Subtraction Subtract the corresponding elements

2 3 1 0 1 3
1 4 0 -4 = 1 8
1 5 1 3 -2 2
A B = C

It follows therefore that only matrices of the same size (or order) may be added or subtracted

## 2.2.4 Scalar Multiple Multiply each element by the scalar multiple

1 2 5 3 6 15
3 =
0 3 2 0 9 6

2.2.5 Multiplication The rows of the left hand matrix act on the columns of the right hand matrix.
You go across the rows and down the columns.
6 1
2 1 3 2x6 1x0 3x( 1) 2x( 1) 1x2 3x1 9 3
0 2 =
4 5 6 4x6 5x0 6x( 1) 4x( 1) 5x2 6x1 18 12
1 1
A B = C
2 3 3 2 = 2 2

It follows therefore that the number of columns in the left hand matrix should be the same as the number of
rows in the right hand matrix.

## Data Analysis UG1 5

2.3 Determinants (Square matrices)
2.3.1 Determinant of 2 x 2 Matrices

a 11 a 12
If A = then Determinant of A = detA = |A| = a11 x a22 - a21 x a12
a 21 a 22

Example 2.1
1 2
If A = then Det A = 1x4 3x2 = 4 6= 2
3 4

Example 2.2
3 4
If B = then Det B = ( 3)x( 1) ( 2)x(4) = 3 8 = 3 + 8 = 11
2 1

## 2.3.2 Determinant of 3 x 3 Matrices

a 22 a 23 a 21 a 23 a 21 a 22
Det A = a 11 a 12 a 13
a 32 a 33 a 31 a 33 a 31 a 32

Example 2.3
2 5 4
3 6 0 6 0 3
eg A = 0 3 6 then Det A = 2 5 4
7 1 3 1 3 7
3 7 1
= 2( 3 42) 5(0 18) + 4(0 9)
= 2( 45) 5( 18) + 4(9)
= 90 + 90 + 36
= 36

A similar approach (but far more involved) is used for higher order matrices.

Determinants are only defined for square matrices (where the number of rows equals the number of columns).

## Data Analysis UG1 6

Vector Problems
In all questions:

5 8 1 3 7 2
a= b= c= d= e= f=
12 15 2 4 24 2

## ix) |a| + |b|

Matrices Problems
In all questions:
1 0
4 0 5 1 4 1 1
A= B= C= 3 1 D=
1 2 1 3 2 0 3
1 1
2 0 3 2 2 3
E= 1 2 3 F= 3 1 3
5 3 0 1 5 0

## Calculate the following, or say where the answer is undefined.

1. A + B 2. B + A 3. AT 4. 3B 5. 3B A

6. A + C 7. A 2B 8. BA 9. AB 10. CD

11. DC 12. A3

## 13. a) Det A b) Det B c) Det C

d) Det D e) Det E f) Det F

## Data Analysis UG1 7

Answers to Vector Problems
1.

13 12 10
i) ii) iii)
27 29 11

3 2 3
iv) v) vi)
3 16 2

19 7 2
vii) viii) ix)
27 10 21

2.

## vii) 19i 27j viii) 7i + 10j ix) 2i + 21j

3.
i) 13 ii) 17 iii) 5 iv) 5 v) 25

## Answers to Matrices Problems

9 1 9 1 4 1 15 3 11 3
1. 2. 3. 4. 5.
0 5 0 5 0 2 3 9 4 7
6 2
6. undefined 7.
3 4

4 1 1
19 2 20 4 0 2 64 0
8. 9. 10. 10 3 0 11. 12.
1 6 3 5 1 3 28 8
2 1 2