Linear Algebra Technical Flashcards

1
Q

Initialize a vector

A

import numpy as np
np.array([1,2,3]) or np.array([1], [2], [3])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Calculate the magnitude of a vector

A

np.linalg.norm(v)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Calculate the direction of a vector

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Add two vectors

A

v1 + v2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Scale a vector

A

3 * v1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Subtract two vectors

A

v1 - v2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Initialize a zero vector

A

np.zeros(3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Get the negative of a vector

A

-1 * v1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Perform dot product of two vectors

A
  1. numpy.matmul(v1, v2)
  2. v1.dot(v2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create a random vector

A

np.random.rand(3,1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Calculate the cross product of a vector

A

a = np.array([1,2,3])
b = np.array([4,5,6])
a.shape # (3,)
b.shape # (3.)
np.cross(a,b)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the angle between two vectors

A

np.arccose(np.dot(a1, a2)/ np.linalg(a1) * np.linalg.norm(a2))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Get the Euclidian distance of a vector

A

point1 = np.array((1, 2, 3))
point2 = np.array((1, 1, 1))
dist = np.linalg.norm(point1 - point2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Get the projection of a vector

A

Projection of the vector = a.b/||b||**2 * b
scalar_projection = np.dot(a,b)/ np.dot(b,b)
vector_projection = scalar_projection * b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Create linearly independent matrix

A

np.random.randint(10, size=(2,5))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Perform dot product of orthogonal vectors

A

a1 = np.array([2,3])
a2 = np.array([3, -2])
dot(a1,a2)

17
Q

Initialize a matrix

A

import numpy as np

rows = 3
cols = 2
size = rows*cols

mat = np.array([0]*size).reshape(rows,cols)

18
Q

Calculate matrix determinant

A

mat = np.random.randint(25, size=(5,5))
determinant = np.linalg.det(mat)

19
Q

Prove invertible matrix vs det

A
20
Q

Linearly dependent vs det

A
21
Q

Prove properties of det A = 0

A
22
Q

Calculate rank of a matrix - different approaches

A
23
Q

Calculate rank of a matrix -

A
24
Q

Transpose a matrix

A
25
Q

Eigen value calcualtion

A
26
Q

Eigen vector calculation

A
27
Q

Create unit vector

A