## Vectors

Vectors are lines which have a constant direction and lenght and it can it move in given system of coordinators. Coordinates of vector u are (u1,u2) in surface and (u1,u2,u3) in space.

\$\$\$APPLET

Applet Vector AB where A is starting point and B is ending point

A vectors are usually marked the same way as the coordinates of a points v = (x1,y1), where x1 is the x-axis vector coefficient and y1 is its y coefficient. This vector can be drawn as a line from the point A with coordinates (a0,a1) to B dot with coordinates (b0,b1).

x unit vector is i = (1, 0) and y unit is i = (1, 0). This is valid in a surface, in space z coordinate is to be added. Unit vectors then will be (1, 0, 0), (0, 1, 0) a (0, 0, 1). (vectors that have a length of one)

Vector addition is performed by adding the terms together and their results are also vectors

Example :
Vectors are added and substraction of vectors u = (u0, u1, u2) and v =(v0, v1, v2) :

w = u + v = (u0 + v0, u1 + v1, u2 + v2)
w = u - v = (u0 - v0, u1 - v1, u2 - v2)

\$\$\$APPLET

### Lenght of vectors

Lenght of vectors AB=(x,y,z) represents vector absolute value and it is calculated as follows:

|AB| = sqrt(x^2 + y^2 + z^2).

It is the same as the distance between dots (x,y,z) and (0,0,0).

## Matrices

A matrix is a rectangular array of numbers. Its elements are doubly indexed , and by convention the first inex indicates the row and the second indicates the column. Specially selected table of real and complex numbers is called a matrix.

\$\$\$APPLET

Applet Matrix

Number a(i,j) is an element of matrix that containsn columns and m lines, for which it is valid that 1 ≤ im and 1 ≤ jn. The size of the matrix m x n, which is inscribed asA(m x n). The first index of i element of the matrix a(i,j) shows in which line the element is situated, analogically of the index j shows the column. For example a(2,4) refers to the element in the second row, fourth column.

Let`s see now a matrix type 1 x n. This matrix can be called a horizontal or line vector. It is marked by lower-case letters :

`   a = | a(1) a(2) . . . a(n) |`

A matrix is called a square one if the number of lines and columns in the matrix is the same (e.g. matrix 3x3, 4x4).

Matrix is a diagonal one if all elements above and under the diagonalare zero. A diagonal is a group of dots of matrix with the same index in x and y directions.

```                      | 1 0 0 |
Diagonal`s matrix A = | 0 1 0 |
| 0 0 2 |```

A special case of diagonal matrix is a unit matrix (or identity matrix), whose all elemnts are 1. It is usually marked by symbol I.

```                       | 1 0 0 0 |
| 0 1 0 0 |
A unit matrix I = | 0 0 1 0 |
| 0 0 0 1 |```

A matrix with all its elements being zero, is a zero matrix. It is marked O.

Matrix B is inverse to matrix A if it is valid that: A x B = I, alebo B = A ^ (-1)

Matrix adding is defined for matrixes of the same type in the way that element a(i,j) of A matrix is added to each element b(i,j) of B matrix B, for 1 ,...,m and 1 ,...,n.

```     | 0 2 0 |      | 1 0 0 |        | 1 0 0 |
A = | 7 5 1 |, B = | 2 1 0 |, A+B = | 9 6 1 |.
| 2 4 5 |      | 3 4 1 |        | 5 8 6 |```

### Multiplying matrix A by scalar

By a scalar we understand one number from defining group. When multiplying, every element of the matrix is by the scalar.

Example:

```    | 1 2  3 |
A = | 0 1 -2 |, k = 3
|-1 0  2 |
| 1 2  3 |       | 3 6  9 |
A*k = | 0 1 -2 | * 3 = | 0 3 -6 |
|-1 0  2 |       |-3 0  6 |```

## Homogeneous coordinates

To simplify calculation of the transformation we use representation of dots by the means of homogeneous coordinates.

Four organized numbers [x, y, z, w] is called a right-angle homogeneous coordinates of point P with carthezian coordinates [X, Y, Z] in three-dimensional space, if

x            y            z
X = ---  , Y = ---  , Z = ---   , = R - {0}.
w           w        w

Most frequently it is selected w = 1, because it is easy. In such a case, homogene coordinates of the point are [X, Y, Z, 1].

Matrix 4x4 reprezenting a linear transformation of point P = [x, z, y, w] onto point P' = [x',  y' , z' , w'] will be marked A.

```    | a11 a12 a13 0 |
A = | a21 a22 a23 0 |
| a31 a32 a33 0 |
| a41 a42 a43 1 |
```

The value of the point P' from the point P will be calculated as follows:

| a11  a12  a13  0 |
P' = [x' y' z' w'] = P*A  =  [x y z w] * | a21  a22  a23  0 |.
| a31  a32  a33  0 |
| a41  a42  a43  1 |

For matrix 3x3 we proceed similarly.