Basics of Linear Algebra for machine learning
As we know that Mathematics is used in Data Science, and mathematics plays a major role in Machine Learning and Deep Learning
Here is the percentage used mathematics
1.Linear Algebra — 35%
2.Probability and Statics — 25%
3.Calculus— 15%
4.Algorithms — 15%
5.Others — 10%
Here are the insights of this article :
1) Introduction of a Vector
2) Length of a Vector
3)Addition of Vectors 2D
4)Subtraction of Vector 2D
5)Multiplication of vector 2D
6)Length of 3D
7)Definition of R cap
8)Proof of Addition vector
9)Dot Product
10)The angle between 2 vectors
11)ORTHOGONAL vector
12)Proof about the diagonals of a Parallelogram
Scalars
A field in a scalar is mostly used in the space,
Scalar should be a real number, if we add two real numbers the output will be a real number, a scalar is called magnitude, it doesn’t have direction, length
In short scalar is nothing but a value
Vectors
Vector is used very extensively where we are working with known data.
In vectors, the output won’t be a real number
Majorly it has 2 types
1.Directions
2.length
Direction: it is an orientation. It is a visual thing
Length: It is a physical visual concept where we can measure
So vectors can fit in a place where we can visualize them
In the graph, the line is passing through the NE direction, shows a certain length
And this called a Vector and this how we graph a vector, the direction can be drawn in any place
Vector no need to start at the origin, can start anywhere
Example: graph
Here is a vector and naming as ⊽
⊽ =vector ⊽
⊽=it has some components as it is passing from the origin so taking as
X component=3
Y component =4
⊽=[3,4]
It can be also written as in column
Another example:
ū=[-3,5]
X component=-3
Y component =5
It can be also written as in column
Length of a Vector:
Length of a Vector is denoted by ॥⊽॥
॥⊽॥ is the notation of length of a vector, it is calculated by the hypotenuse of the Pythagorean right-angled triangle.
The length of a Vector is calculated by the square root of the sum of the squares of the component
⊽=[2,4]
॥⊽॥²=²² + ⁴²
॥⊽॥=√²² + ⁴²
॥⊽॥= √20
Addition of vectors:
Yes, we can add vectors by adding the two or more vectors together into a sum vector
It is adding horizontal components and vertical components on each side
(⊽+ū)=ū+⊽
Example
Subtraction of vectors:
Yes we can subtract the vectors the same as adding of negative vector to the sum of two or more vectors
It is subtracting of horizontal components and vertical components on each sides
⊽-ū=ū+(-⊽)
Example
Multiplication of vectors
Vector multiplication for the multiplication of two (or more) vectors with themselves, is defined as the product of the 2 vectors. Thus, A ⋅ B = |A| |B| cos θ
It is multiplying of horizontal components and vertical components on each side
Example
Length of a Vector 3D:
It is calculated by the hypotenuse of the pathogen’s right-angled triangle.
Later in the Pythagorean Article, we will be solving the commutative of addition of vectors
Example
In short we can call , It is same as the length of the vector
Definition of Ř
⊽=[v1,v2]
ū=[u1,u2,u3]
ŵ=[w1,w2,w3,…….wn]
Here there are 3 vectors v,u,w. far we have seen 2D,3D dimensions in a plane, we can draw and visualize up to a 3 Dimensional graph.
So for drawing more than 3 dimensions in vector it will take the help of 2,3 dimensions
The beauty of algebra and power of vector is that if n is 4 then it will take from 2D,3D components
In technical words vectors written as
⊽=[v1,v2]= 2 -Tuple
ū=[u1,u2,u3] = 3 -Tuple
ŵ=[w1,w2,w3,…….wn]= n-tuple
Ŕ is called a set of all n tuples of the real numbers
Length of 3Dvectors
So the length of the vector in two components we have used the Pythagorean theorem
Same way if there are 4 or more components we need to square root the first component with the second component
Proof of vector addition is cumulative and associative:
First define ⊽,ū,ŵ∈Ŕ are the 3 vectors with n components
We have to prove that
1. ū+⊽=⊽+ū
2. (ū+⊽)+ŵ=ū+(⊽+ŵ)
Hence vector addition is cumulative and associative
Dot product
Multiple vector or product of the vector is called Dot vector
So there is no separate object for dot vector
Multiplication of two or more real numbers is defined as the dot product
ū.⊽ here the dot(.) says to be a dot vector
Example:
ū=[u1,u2,u3,…un] ⊽=[v1,v2,v3,….vn]
ū.⊽ =[u1v1+u2v2+u3v3+,………..unvn]
Here in dot product the result always will be real numbers, unlike the vector.
If we multiply two vectors we get the real number
ū=[1,2,3] ⊽=[4,5,6]
ū.⊽ = 4+10+6
=20
The angle between 2 vectors
ū=[1,2,3] ⊽=[1,1,1]
cosӨ=ū.⊽
ū.⊽=1+2+3=6
॥ū॥=√1+4+6=√11
॥⊽॥=√1+1+1=√3
ORTHOGONAL vector:
It says the Pythagorean of the determine about two vectors when they are perpendicular, should be equal to 0
So we have known that when two vectors are perpendicular we will call as orthogonal vector
In this graph it has u,v and the angle is 90 degrees and that means angle btw two vectors
ū.⊽ =0
As we have known that
If two vectors ū.⊽ are orthogonal if and only if then it will be 0
ū.⊽ =0
Let’s see if
ū=[3,4] ⊽=[4,3]
ū.⊽ =(-3)(4)+(4)(3)
=0
In short Orthogonal vector is equal to 0 in any case
Proof about the diagonals of a Parallelogram:
Here we need to prove the diagonals of a Parallelogram of perpendicular if and only if their sides are equal
So in the graph, we have drawn a parallelogram of two vectors u,v with that we made a parallelogram, the length is equal and drawn the diagonal for ū+⊽ and the second diagonal is ū+⊽. So let us see how we will do in math
(ū+⊽).(ū- ⊽) = 0
=>॥ū॥=॥⊽॥
Assume (ū+⊽).(ū- ⊽) = 0
The dot product is expanded here is
॥ū॥² — ū.⊽+ ⊽.ū-॥⊽॥² =0
॥ū॥²-॥⊽॥² = 0
(ū+⊽).(ū- ⊽) ॥⊽॥²
॥ū॥= ॥⊽॥
Assume
॥ū॥= ॥⊽॥
Consider (ū+⊽).(ū.⊽)
॥ū॥²- ū.⊽+ ū.⊽- ॥⊽॥²
॥ū॥²-॥⊽॥²
0
We had proved that dot product is zero then the lengths are equal, so the diagonals of a Parallelogram of perpendicular if and only if their sides are equal
Hence we had proved diagonals of the parallelogram