# Vector, Scalar, and Matrix Arithmetic

## Vector Math:

Vectors are sometimes denoted by bracketed numbers representing directions.

### Example - 2D Vector:

### Example - 3D Vector:

### Addition:

To add two vectors, just add each element in one vector with its counterpart in the other vector.

#### Example:

### Subtraction:

Vector subtraction works the same as vector addition, but you subtract the elements instead of adding them.

#### Example:

### Multiplication:

There are two different kinds of multiplication when it comes to vectors. They are the dot product and the cross product. Both methods give a vector that is at a right angle to the two vectors being multiplied, but the dot product results in a scalar and the cross product results in a vector.

Both the dot and cross product require the length (magnitude) of the vectors and the angle between them.

The cross product can only be done if both vectors are three dimensional.

#### Example - Dot Product:

The result of the dot product of two vectors will be a scalar. If the scalar is zero, then the two vectors are at a right angle to each other.

#### Example:

#### Cross Product with Two Vectors:

The result of the cross product of two vectors will be a vector. If the vector is filled with only zeros, then the two vectors are parallel to each other.

##### Example:

### Division:

It isn't possible to divide one vector by another.

## Scalar Math:

A scalar can be any real number. Both vectors and matrices can be multiplied by scalars.

### Addition Subtraction:

Generally, a scalar cannot be added or subtracted with a vector or a matrix.

### Multiplication:

A scalar can be multiplied with both vectors and matrices. When it comes to vectors you multiply the scalar by with the magnitude and direction for matrices you simply multiply each element in the matrix by the scalar.

#### Example - Vector/Matrix:

#### Example - Matrix:

### Division:

To divide a matrix or vector with a scalar, just divide every element of the matrix or vector by the scalar.

#### Example - Vector/Matrix:

#### Example - Matrix:

## Matrix Math:

To do any of the following operations on two matrices, both matrices must be of the same size. As an example, only a
*3x3* matrix can be added, subtracted, or multiplied by another
*3x3* matrix.

### Addition:

To do matrix addition you simply need to add the first element in the first matrix to the first element to the second matrix and so on.

#### Example:

### Subtraction:

Matrix subtraction works the same as addition, but you subtract the elements instead of adding them.

#### Example:

### Multiplication:

To do matrix multiplication, you need two matrices where the first one has the same number of rows as the second has columns. If these conditions aren't met, then you cannot multiply two matrices.

#### Example:

### Division:

It isn't possible to divide one matrix by another.

## References:

- Dot Product - Reference #1, Reference #2, Reference #3, Reference #4
- Cross Product - Reference #1, Reference #2, Reference #3, Reference #4, Reference #5