Linear Algebra

## Explore the Flashcards:

Linear Algebra is a branch of mathematics that deals with vector spaces and linear mappings between these spaces. It includes the study of lines, planes, and subspaces, but is also concerned with properties common to all vector spaces.

Matrix

Collection of numbers ordered in rows and columns. A matrix can only contain numbers, symbols, or expressions. Matrices can be added, subtracted and multiplied.

How do we find the total number of elements in a matrix?

The product of the number of rows and the number of columns in the matrix.

How many elements does a matrix with dimensions m = 5 and n = 5 have?

25

Line

A straight one-dimensional figure having no thickness and extending infinitely in both directions.

Scalar

A scalar is a single numerical value, as opposed to a vector or matrix which contain multiple values. Scalars are all numbers from algebra of dimension 0, can be considered as 1ₓ1 matrix.

In terms of geometry, a scalar can be represented as:

A point

Vector

A vector that has only one column and multiple rows.

Geometrically a vector can be represented as:

A line

Column Vector

A vector that has only one column and multiple rows.

Row Vector

A vector that has only one row and multiple columns.

Length of a vector

The length of a vector is equal to the number of elements in it.

If a vector has a length of 4, it has:

4 rows or 4 columns

How many dimensions does a vector have?

1

How do you declare a vector in Python?

**np.array**function (part of the NumPy library).

How do you declare a matrix in Python?

**np.array**function with a list of lists, where each inner list represents a row of the matrix.

Tensor

A collection of matrices.

How do you create a tensor in Python?

Transposition

The process of interchanging the rows and columns of a matrix or vector.

Transpose of vector

To transpose a vector means to interchange its orientation. If you have a row vector, its transpose will be a column vector. Conversely, if you have a column vector, its transpose will be a row vector.

Transpose of a matrix

Transposing a matrix turns each row into column.

How do you transpose a matrix in Python?

To transpose a matrix in Python, you can use these the **.T** attribute of the NumPy array.

How do you multiply scalars?

Scalars are single numerical values, and multiplying them follows the standard rules of arithmetic.

Dot product of two vectors

The dot product is an operation that takes two vectors and returns a scalar. To calculate the dot product, you multiply corresponding components of the vectors together and then sum up these products.

Multiplying matrix by a scalar

When you multiply a matrix by a scalar, you simply multiply every entry in the matrix by that scalar. This operation affects the magnitude of the matrix but not its direction.

Adding vectors

Vector addition is performed component-wise. If you have two vectors A and B of the same dimension, their sum C=A+B is a vector where each component is the sum of the corresponding components of A and B.

Subtracting vectors

Vector subtraction, like vector addition, is performed component-wise. If you have two vectors A and B of the same dimension, their difference C=A−B is a vector where each component is the difference of the corresponding components of A and B.

How do you add vectors in Python?

Adding matrices

Matrix addition is performed element-wise. If you have two matrices A and B of the same dimensions, their sum C=A+B is a matrix where each element is the sum of the corresponding elements of A and B.

Subtracting matrices

Matrix subtraction, like matrix addition, is performed element-wise. If you have two matrices A and B of the same dimensions, their difference C=A−B is a matrix where each element is the difference of the corresponding elements of A and B.

Multiplication of vector by a scalar

When you multiply a vector by a scalar, you multiply each component of the vector by that scalar.

Multiplication of matrices

To multiply two matrices, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix will have the same number of rows as the first matrix and the same number of columns as the second matrix.