0% found this document useful (0 votes)
49 views129 pages

Vector Operations in Computational Physics

The document is an introduction to Computational Physics, specifically covering vector operations, including vector addition, subtraction, scalar and cross products, and triple products. It also discusses the del operator, gradient, divergence, and curl, along with numerical problems and homework assignments for practice. Additionally, it provides an overview of matrices, their types, and examples of matrix operations.

Uploaded by

raghav122006
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views129 pages

Vector Operations in Computational Physics

The document is an introduction to Computational Physics, specifically covering vector operations, including vector addition, subtraction, scalar and cross products, and triple products. It also discusses the del operator, gradient, divergence, and curl, along with numerical problems and homework assignments for practice. Additionally, it provides an overview of matrices, their types, and examples of matrix operations.

Uploaded by

raghav122006
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to Computational Physics

Course Code: PHY1003

Slot: C11 + C12 + C13

Dr. SANJIB NAYAK


Assistant Professor, (VIT Bhopal)

1
Vector Operations
Vector Operations
Subtraction of vectors: Let 𝑎 and 𝑏
be two vectors. We define 𝑎-𝑏 as the
sum of the vector a and the vector (- 𝑏
). To subtract 𝑏 from 𝑎, invert the
direction of 𝑏 and add to 𝑎.

Example: Two vectors of equal magnitude 5 units have an angle of 60°


between them. Find the magnitude of (a) the sum of the vectors and (b) the
difference of the vectors.
Vector Operations
Example: Suppose a small ball is moving inside a long tube at a speed 3 m/s and the tube
itself is moving in the room at a speed 4 m/s along a direction perpendicular to its length.
In which direction and how fast is the ball moving as seen from the room?

4
𝐴𝐶 2 = 𝐴𝐵2 + 𝐵𝐶 2 tan 𝜃 =
3
= 32 + 42 4
= 25 𝜃 = tan−1 ( )
3
AC = 5 𝜃 = 58°
Vector Operations
Home Work: Find the resultant of the three vectors shown in figure.

Home Work: The magnitudes of


vectors OA, OB and OC in figure are
equal. Find the direction of OA + OB -
OC
Vector Operations
Scalar product of vectors: The dot product (also called
scalar product) of two vectors 𝑎 and 𝑏 is defined as
𝒂. 𝒃 = 𝒂𝒃 𝒄𝒐𝒔𝜽

Example: The work done by a force 𝐹 during a displacement 𝑟 is given by 𝐹.𝑟.


Suppose a force of 12 N acts on a particle in vertically upward direction and the
particle is displaced through 2.0 m in vertically downward direction. Find the
work done by the force during this displacement.
𝑾 = 𝑭.𝒓
The angle between the force and the 𝑾 = 𝑭𝒓𝒄𝒐𝒔𝜽
displacement is 180°. Thus, the work (12N)(2.0)cos180
done is negative. -24 N-m
Vector Operations
Dot Product of Two Vectors in terms of the Components along the
Coordinate Axes:
Vector Operations
The cross product of vectors: The cross product
(also called vector product) of two vectors a and
is defined as
|𝒂 × 𝒃| = 𝒂𝒃 𝒔𝒊𝒏𝜽
Or
𝒂 × 𝒃 = 𝒂𝒃 𝒔𝒊𝒏𝜽 𝒏

The direction 𝒂 × 𝒃 of is perpendicular to both 𝒂 and 𝒃. Thus, it is


perpendicular to the plane formed 𝒃𝒚 𝒂 𝒂𝒏𝒅 𝒃.
Vector Operations
The cross-product is noncommutative.
𝒂 × 𝒃 = −𝒃 × 𝒂
The cross-product follows the distributive law.
𝒂× 𝒃+𝒄 = 𝒂×𝒃+𝒂×𝒄
The cross-product does not follow the associative law.
𝒂 × 𝒃 × 𝒄 ≠ (𝒂 × 𝒃) × 𝒄

𝑖×𝑗= 𝑘 𝑖×𝑖=0
𝑗×𝑘 = 𝑖 𝑗×𝑗=0
𝑘×𝑖= 𝑗 𝑘×𝑘 =0
Vector Operations
Cross Product of Two Vectors in terms of the Components along the
Coordinate Axes:
Vector Operations
Example: The vector has 𝒂 magnitude of 5 unit, 𝒃 has a magnitude of 6 unit
and the cross product of 𝒂 and 𝒃 has a magnitude of 15 unit. Find the angle
between 𝒂 and 𝒃 .

Solution: If the angle between 𝒂 and 𝒃 is 𝜃, the cross product will have a
magnitude
𝐴 × 𝐵 = 𝐴𝐵 𝑆𝑖𝑛𝜃
15 = 5 × 6 𝑆𝑖𝑛𝜃
15
𝑆𝑖𝑛𝜃 =
30
1
𝑆𝑖𝑛𝜃 =
2
𝜃 = 30° 𝑜𝑟 150°
Vector Operations
Example: Write the unit vector in the direction of 𝐴 = 5𝑖 + 𝑗 − 2𝑘.

Solution: First calculate the magnitude of vector 𝑨 and then divide


the each component of vector by the magnitude to gets the unit
vector.

𝐴 = 52 + 12 + (−2)2 = 30

5 1 2
𝐴= 𝑖+ 𝑗− 𝑘.
30 30 30
Vector Operations
Example: If |𝑎 + 𝑏| = |𝑎 − 𝑏| show that 𝒂 𝒑𝒆𝒓𝒑𝒆𝒏𝒅𝒊𝒄𝒖𝒍𝒂𝒓 𝒕𝒐 𝒃
Vector Operations
Example: If 𝐴 = 2𝑖 − 3𝑗 + 7𝑘, 𝐵 = 𝑖 + 2𝑘, 𝑎𝑛𝑑 𝐶 = 𝑗 − 𝑘 find 𝐴. 𝐵 × 𝐶 .
Vector Operations
Triple product: Since the cross product of two vectors is a vector, it can be
dotted and crossed to form a triple product.

Scalar triple product: If we take a dot product with the resultant of vectors
B and C with another vector A.

𝐴. (𝐵 × 𝐶)
Geometrically, | 𝐴. (𝐵 × 𝐶) | is the
volume of parallelepiped generated by
vectors A, B, and C.
Because, | 𝐵 × 𝐶 | is the base
parallelepiped while |𝑨𝒄𝒐𝒔𝜽| is the
altitude.
Vector Operations
Triple product properties: (1) The scale triple product is unchanged under
the circular shift of vectors A, B, and, C.
𝑨. 𝑩 × 𝑪 = 𝑩. 𝑪 × 𝑨 = 𝑪. 𝑨 × 𝑩

(2) Swapping any two of the three operands negates the triple product
𝑨. 𝑩 × 𝑪 = - 𝑨. 𝑪 × 𝑩 = -𝑩. 𝑨 × 𝑪 = - 𝑪. 𝑩 × 𝑨

(3) The scalar triple product can also be understood as the determinant of
the 3×3 matrix that has the three vectors either as its rows or its columns.

𝐴𝑥 𝐴𝑦 𝐴𝑧
𝑨. 𝑩 × 𝑪 = 𝐵𝑥 𝐵𝑦 𝐵𝑧
𝐶𝑥 𝐶𝑦 𝐶𝑧
NOTE: 𝑨. 𝑩 × 𝑪 is meaningless.
Vector Operations
(4) If the scalar triple product is equal to zero, then the three vectors a, b,
and c are coplanar, since the parallelepiped defined by them would be flat
and have no volume.
𝑨. 𝑨 × 𝑪 = 𝑨. 𝑩 × 𝑨 = 𝑩. 𝑨 × 𝑨 = 𝟎

The simple product of two triple products (or the square of a triple product),
may be expanded in terms of dot products:

𝑨. 𝑫 𝑨. 𝑬 𝑨. 𝑭
(𝑨. (𝑩 × 𝑪))((𝑫. (𝑬 × 𝑭)) = 𝑩. 𝑫 𝑨. 𝑬 𝑩. 𝑭
𝑪. 𝑫 𝑨. 𝑬 𝑪. 𝑭
Vector Operations
Vector triple product: If we take a cross product with the resultant of
vectors B and C with another vector A. It can be simplified by BAC-CAB

𝑨 × 𝑩 × 𝑪 = 𝑩 𝑨. 𝑪 − 𝑪 𝑨. 𝑩
Please note that
𝑨 × 𝑩 × 𝑪 = −𝑪 × 𝑨 × 𝑩 = −𝑨 𝑩. 𝑪 + 𝑩 𝑨. 𝑪

Problem: Prove the BAC-CAB rule by writing out both sides in component
form.

Home Work: Prove that


Del Operator
Gradient
Ordinary Derivative
Suppose, we have the function of one variable: f(x). What does the derivative,
df/dx, do for us?
Answer: It tells us how rapidly the function f(x) varies when we change the
argument x by a tiny amount, dx:
df = (df/dx)dx
In words: If we change x by an amount dx, then f changes by an amount df; the
derivative is the proportionality factor.

The derivative df/dx is the slope of the graph of f versus x.


Gradient
The derivative is supposed to tell us how fast the function varies as studied
previously in 1-D.
What will be the scenario if your function depends on three coordinates, e.g.,
temperature T (x,y,z) in room
A theorem on partial derivate
Gradient
Like any other vector, gradient also has magnitude and direction. Let us
look at the geometrical meaning of gradient.

If we fix |dI| (magnitude of length vector) then the maximum change in


T occurs when θ = 0, i.e., dT is greatest when I move in the same
direction as gradient T.
Gradient
Numerical Problem
Find the gradient of r = SQRT(x2 + y2 + z2)
Gradient
Numerical Problem
Gradient
Home Work: Calculate the gradients of given functions.
Divergence

The gradient has the formal appearance of a vector (i.e., del operator)
multiplying a scaler T.

The del is not a vector in the usual sense, and it is without specific meaning
until we provide it with a function to act upon. To be precise, we should
say del is vector operator that acts upon T, not a vector that multiplies T.
Divergence
From the definition of del operator, we can construct the
divergence

The divergence of a vector function is itself a scalar. You cant have the
divergence of the scaler, i.e., it is meaningless.
Divergence
Geometrical Interpretation
The name divergence is well chosen as it measures of much the vector v spreads
out (diverges) from the reference point in question.
Divergence
Numerical Problems
Calculate the divergence of these functions..
Divergence
Numerical Problems
Home Work: Estimate the divergence of the given functions.
Curl
Again, from the definition of del, we can
construct the curl

NOTE: Curl of a vector function V is, like any cross product, a


vector. You can not have the curl of scaler function; that is
meaning less
Curl
Geometrical Interpretation
The name curl is also well chosen as it measure of how much the
vector v curls around the point in question.

The functions, which are shown here, have a substantial curl.


Curl
Geometrical Interpretation
Guess the curl of these functions…
Curl
Numerical Problem
Calculate the curl of given functions.
Va = -yX + xY & Vb = xY
Curl
Home work: Calculate the curl of given functions.
Matrix
A matrix is a rectangular arrangement of numbers into rows and columns. For
example, matrix has two rows and three columns.

A matrix having m rows and n


columns is called a matrix of order
m × n or simply m × n matrix (read
as an m by n matrix). So referring to
the above example of matrices, we
have A as a 2 × 3 matrix, and A has 2
× 3 = 6 elements.
Matrix
Example 1: If a matrix has 8 elements, what are the possible orders it can have?
We know that if a matrix is of order m × n, it has mn elements. Thus, to find
all possible orders of a matrix with 8 elements, we will find all ordered pairs
of natural numbers, whose product is 8. Thus, all possible ordered pairs are
(1, 8), (8, 1), (4, 2), (2, 4).
Hence, possible orders are 1 × 8, 8 ×1, 4 × 2, 2 × 4
1
Example 2: Construct a 3 × 2 matrix whose elements are given by aij = 2|i-3j|.
In general, a 3 × 2 matrix is given by 1
𝑎22 = 2 − 3 × 2 = 2
1 2
𝑎11 𝑎12 𝑎 11 = 1 − 3 × 1 = 1
2 1 3
𝐴 = 𝑎21 𝑎22 1 1 𝑎 32 = 3 − 3 × 2 =
𝑎 = 2 − 3 × 1 = 2 2
𝑎31 𝑎32 21
2 2
1 5
1 𝑎31 = 3 − 3 × 1 = 0 1
𝑎𝑖𝑗 = 𝑖 − 3𝑗 2 2
2 𝐴= 1 2
𝑖 = 1,2,3 𝑎𝑛𝑑 𝑗 = 1,2 1 5
𝑎12 = 1 − 3 × 2 = 2 3
2 2 0 2
Matrix
Different types of matrix
(1) Column Matrix: A matrix is said to be a column matrix if it has only one
column.
0
3 A is a column matrix
A = −1
1
of order 4 × 1.
2

(2) Row Matrix: A matrix is said to be a row matrix if it has only one row.

1 B is a row matrix of
𝐵= − 5 2 3
2 order 1 × 4.
Matrix
Different types of matrix
(3) Square Matrix: A matrix in which the number of rows are equal to the
number of columns, is said to be a square matrix. Thus an m × n matrix is said
to be a square matrix if m = n and is known as a square matrix of order ‘n
3 −1 0
3 A is a square
𝐴= −3 2 1 matrix of order 3.
2
4 3 −1

(4) Diagonal Matrix: A square matrix B = [bij]m × m is said to be a diagonal


matrix if all its non-diagonal elements are zero, that is a matrix B = [bij]m × m is
said to be a diagonal matrix if bij = 0, when i ≠ j.
−1 0 0
−1 0
𝐴= 4 𝐵= C= 0 2 0
0 2
0 0 3

A, B, and C are the diagonal matrix of order 1, 2, and 3.


Matrix
Different types of matrix
(5) Scaler Matrix: A diagonal matrix is said to be a scalar matrix if its diagonal
elements are equal, that is, a square matrix B = [bij]n × n is said to be a scalar
matrix if
bij = 0, when i ≠ j
bij = k, when i = j, for some constant

3 0 0
−1 0
𝐴= 3 𝐵= C= 0 3 0
0 −1
0 0 3

A, B, and C are the scaler matrix of order 1, 2, and 3.


Matrix
Different types of matrix
(6) Identity Matrix: A square matrix in which elements in the diagonal are all
1 and rest are all zero is called an identity matrix. In other words, the square
matrix A = [aij] n × n is an identity matrix, if
aij = 1 if i = j
aij = 0 if i ≠ j
1 0 0
1 0
𝐴= 1 𝐵= C= 0 1 0
0 1
0 0 1

A, B, and C are the identity matrix of order 1, 2, and 3. Observe that a


scalar matrix is an identity matrix when k = 1. Every identity matrix is
clearly a scalar matrix but not all scaler matrix are identity matrix.
Matrix
Different types of matrix
(7) Zero Matrix: A matrix is said to be zero matrix or null matrix if all its
elements are zero
0 0 0 0 0
𝐴= 0 𝐵= C=
0 0 0 0 0

(8) Rectangular Matrix: A rectangular matrix is a matrix in which the


number of rows is NOT equal to the number of columns.
Matrix
Equality of matrix: Two matrices A = [aij] and B = [bij] are said to be equal if
(i) they are of the same order
(ii) each element of A is equal to the corresponding element of B, that is aij =
bij for all i and j.
2 3 2 3 3 2 2 3
For example, 𝑎𝑛𝑑 are equal matrix while 𝑎𝑛𝑑
0 1 0 1 0 1 0 1
are not equal matrix

𝑥 + 3 𝑧 + 4 2𝑦 − 7 0 6 3𝑦 − 2
𝐸𝑥𝑎𝑚𝑝𝑙𝑒: 𝐼𝑓 −6 𝑎−1 0 = −6 −3 2𝑐 + 2 , 𝑡ℎ𝑒𝑛 find
𝑏 − 3 −21 0 2𝑏 + 4 −21 0
the values of a, b, c, x, y, and z

Sol: As the given matrices are equal, therefore, their corresponding elements
must be equal. Comparing the corresponding elements, we get
𝒙+𝟑=𝟎 𝒂 − 𝟏 = −𝟑 𝒂 = −𝟐, 𝒃 = −𝟕, 𝒄 = −𝟏
𝒛+𝟒=𝟔 𝟎 = 𝟐𝒄 + 𝟐 𝒙 = −𝟑, 𝒚 = −𝟓, 𝒛 = 𝟐
𝟐𝒚 − 𝟕 = 𝟑𝒚 − 𝟐 𝒃 − 𝟑 = 𝟐𝒃 + 𝟒
Matrix
Sum of two matrix

This new matrix is the sum of the


above two matrices. We observe
that the sum of two matrices is a
matrix obtained by adding the
corresponding elements of the given
matrices. Furthermore, the two
matrices have to be of the same
order.
Matrix
Difference of two matrix

We observe that the difference of two matrices is a


matrix obtained by subtracting the corresponding
elements of the given matrices.
Matrix
Example: If 𝑨 = 𝟏 𝟐 𝟑 𝐚𝐧𝐝 𝐁 = 𝟑 −𝟏 𝟑
𝒕𝒉𝒆𝒏 𝒇𝒊𝒏𝒅 𝟐𝑨 − 𝑩.
𝟐 𝟑 𝟏 −𝟏 𝟎 𝟐

𝟏 𝟐 𝟑 𝟑 −𝟏 𝟑
𝟐𝑨 − 𝑩 = 𝟐 −
𝟐 𝟑 𝟏 −𝟏 𝟎 𝟐

𝟐 𝟒 𝟔 −𝟑 𝟏 − 𝟑
= +
𝟒 𝟔 𝟐 𝟏 𝟎 −𝟐

𝟐−𝟑 𝟒+𝟏 𝟔−𝟑


=
𝟒+𝟏 𝟔+𝟎 𝟐−𝟐

−𝟏 𝟓 𝟑
=
𝟓 𝟔 𝟎
Matrix
Properties of matrix addition

(i) Commutative Law: If A = [aij], B = [bij] are matrices of the same order,
say m × n, then A + B = B + A.

(ii) Associative Law: For any three matrices A = [aij], B = [bij], C = [cij] of
the same order, say m × n, (A + B) + C = A + (B + C).

(iii) Existence of additive identity: Let A = [aij] be an m × n matrix and O be


an m × n zero matrix, then A + O = O + A = A. In other words, O is the
additive identity for matrix addition.

(iv) The existence of additive inverse: Let A = [aij] m × n be any matrix, then
we have another matrix as – A = [– aij] m × n such that A + (– A) = (– A) +
A= O. So – A is the additive inverse of A or negative of A.
Matrix
Matrix Multiplication: Firstly, we
can multiply the matrix by a scalar A,
it means k A where k is the scaler.

Matrix Division: We can also divide


the matrix A by a scalar.

Multiply each element of the


matrix by the scaler Divide each element of the matrix
by the scaler
Matrix
Matrix Multiplication: For the multiplication of two matrices A and B, the
number of columns in A should be equal to the number of rows in B.
Furthermore, to get the elements of the product matrix, we take rows of A and
columns of B, multiply them element-wise, and take the sum. Formally, we
define the multiplication of matrices as follows.
Matrix

3 2
Example: If A and B =
1 4
3 2
1 4 then define AB and BA.
5 3

In the case of the multiplication


of A with B, A has 2 columns
while B has 3 rows. Hence, the
number of columns of A not
equal to the number of rows of B.
AB is not defined.

While BA is possible.
Matrix
6 9 2 6 0
Example: Find AB if A = and B =
2 3 7 9 8

If AB is defined, then BA need not be defined. In the above example, AB is


defined but BA is not defined because B has 3 columns while A has only 2
(and not 3) rows. If A and B are, respectively m × n, k × l matrices, then both
AB and BA are defined if and only if n = k and l = m. In particular, if both A
and B are square matrices of the same order, then both AB and BA are
defined.
Matrix
2 3
1 −2 3
Example: If A = and B = 4 5 , then find AB and BA, and
−4 2 5
2 5
show that AB ≠ BA.
2 3
1 −2 3 2−8+6 3 − 10 + 15 0 −8
𝐴𝐵 = 4 5 = =
−4 2 5 −8 + 8 + 10 −12 + 10 + 25 10 23
2 5
2 3 2 − 12 −4 + 6 6 + 15
1 −2 3
𝐵𝐴 = 4 5 = 4 − 20 −8 + 10 12 + 25
−4 2 5
2 5 2 − 20 −4 + 10 6 + 25
−10 2 21
= −16 2 37
−18 6 31

In the above example, both AB and BA are of different order and so AB ≠ BA.
But one may think that perhaps AB and BA could be the same if they were of
the same order. But it is not so, here we give an example to show that even if
AB and BA are of the same order they may not be the same.
Matrix
1 0 0 1
Example: If A = and B = , then
0 −1 1 0

0 1
AB =
−1 0

0 −1
and BA =
1 0

Clearly AB ≠ BA.
Thus matrix multiplication is not commutative.
Matrix
The multiplication of matrices possesses the following properties
1. The associative law: For any three matrices A, B, and C. We have (AB)
C = A (BC), whenever both sides of the equality are defined.

2. The distributive law: For three matrices A, B, and C.


(i) A (B+C) = AB + AC
(ii) (A+B) C = AC + BC

3. The existence of multiplicative identity For every square matrix A, there


exists an identity matrix of the same order such that IA = AI = A.

Homework: Verify these properties with the help of


appropriate examples.
Matrix
Homework: The matrices A and B are given below. Estimate AB and BA.
Matrix
Transpose of Matrix: If A = [aij] be an m × n matrix, then the matrix
obtained by interchanging the rows and columns of A is called the transpose of
A. Transpose of the matrix A is denoted by A′ or (AT ). In other words, if A =
[aij]m × n, then A′ = [aji]n × m. 3 5
For example: 3 3 0
𝐴= 3 1 ’
, then A = −1
−1 5 1
0 5
5

Properties of the transpose of the matrices: The transpose of matrices has


some properties, and these properties can be verified by taking suitable
examples.
For any matrices A and B of suitable orders, we have
(i) (A′)′ = A
(ii) (kA)′ = kA′ (where k is any constant)
(iii) (A + B)′ = A′ + B′
(iv) (A B)′ = B′ A′

Homework: Verify these properties using the appropriate matrix.


Matrix
Symmetric Matrix: A square A = [aij] is said to be symmetric if A′ = A,
that is, [aij] = [aji] for all possible values of i and j.

3 2 3
For example: 𝐴= 2 −1.5 −1 is a symmetric matrix as A’ = A
3 −1 1

Skew-symmetric Matrix: A square matrix A = [aij] is said to be a skew-


symmetric matrix if A′ = – A, that is aji = – aij for all possible values of i and
j.
0 𝑒 𝑓
𝐴 = −𝑒 0 𝑔 is a skew-symmetric matrix as A’ = A
For example: −𝑓 −𝑔 0

If a matrix is skew-symmetric, then aii = -aii = 0, i.e., all the diagonal


elements of a skew-symmetric matrix are 0.
Matrix
Theorem 1: For any square matrix A with real number entries, A + A′ is a
symmetric matrix and A – A′ is a skew-symmetric matrix.
Prof: Let B = A + A′, then
𝐵′ = (𝐴 + 𝐴′ )′
= 𝐴′ + (𝐴′ )′
= 𝐴′ + 𝐴
=B
Therefore, 𝐵 = 𝐴 + 𝐴′ is a symmetric matrix.
Now, let
𝐶 = 𝐴 − 𝐴′
𝐶 ′ = 𝐴 − 𝐴′ ′
= 𝐴′ − 𝐴′ ′
= 𝐴′ − 𝐴
= − 𝐴 − 𝐴′
= −𝐶

Therefore, 𝐶 = 𝐴 − 𝐴 is a skew-symmetric matrix.
Matrix
Theorem 2: Any square matrix can be expressed as the sum of a symmetric
and a skew-symmetric matrix.
Prof: Let A be a square matrix, then we can write
1 1
𝐴= 𝐴 + 𝐴′ + 2 (𝐴 − 𝐴′)
2

We know that (A + A′) is a symmetric matrix and (A – A′) is a skew-


symmetric matrix. Since for any matrix A, (kA)′ = kA′
1
Hence, the first part 2 𝐴 + 𝐴′ is a symmetric matrix, and the second part is
1
𝐴 − 𝐴′ is a skew-symmetric matrix.
2

𝟐 −𝟐 −𝟒
Homework: Express the matrix A = −𝟏 𝟑 𝟒 as the sum of
𝟏 −𝟐 −𝟑
symmetric and skew-symmetric matrix.
Matrix
Invertible Matrix
If A is a square matrix of order m × m, and if there exists another square
matrix B of the same order m × m, such that AB = BA = I, then, A is said
to be an invertible matrix and B is called the inverse matrix of A and it is
denoted by A–1.

A rectangular matrix does not possess its inverse, since for the products BA
and AB to be defined and to be equal, matrices A and B must be square
matrices of the same order.

1 0
Also, BA = =𝐼
0 1
Thus B is the inverse of A and
A is the inverse of B.
Matrix
Matrix transformation

(1) The interchange of any two rows or two columns.

(2) The multiplication of the elements of any row or column by a non-zero


number.
Matrix
(3) The addition to the elements of any row or column, the corresponding
elements of any other row or column multiplied by any non zero number.
Matrix
Inverse of Matrix:
R1 = R1+ R2
3 0 2 1 0 0 5 0 0 1 1 0

2 0 -2 0 1 0 2 0 -2 0 1 0

0 1 1 0 0 1 0 1 1 0 0 1

A I

1 0 0 0.2 0.2 0 1 0 0 0.2 0.2 0

1 0 -1 0 0.5 0 2 0 -2 0 1 0

0 1 1 0 0 1 0 1 1 0 0 1

R2 = R2/2 R1 = R1/5
Matrix
Inverse of Matrix:

1 0 0 0.2 0.2 0 1 0 0 0.2 0.2 0

0 0 -1 -0.2 0.3 0 0 1 0 -0.2 0.3 1

0 1 1 0 0 1 0 1 1 0 0 1

R2 = R2-R1 R2 = R2+R3

1 0 0 0.2 0.2 0
Hence, the inverse of matrix is 0 1 0 -0.2 0.3 1
0.2 0.2 0
−0.2 0.3 1 0 0 1 0.2 -0.3 0

0.2 −0.3 0
R3 = R3-R2
Matrix
Different Method for the inverse of the matrix: We need adjoint of the matrix
(adj(A)) and determent of matrix A (det A).

If the matrix order is 2× 𝟐 then the determent of the matrix is


𝑎11 𝑎12
𝑎21 𝑎22 → det 𝐴 = 𝑎11 × 𝑎22 − 𝑎12 × 𝑎21
If the matrix order is 3× 𝟑 then determent of the matrix is

Homework: workout on the determent of fourth order matrix.


Matrix
The adjoint of a square matrix A = [aij]n×n is defined as the transpose of the
matrix [Aij]n×n, where Aij is the cofactor of the element aij. In other words, the
transpose of a cofactor matrix of the square matrix is called the adjoint of the
matrix.

𝑎𝑑𝑗 (𝐴)
Inverse of the matrix can also be calculated using 𝐴−1 =
|𝐴|
Matrix
Homework: Find the inverse of the given matrix A using adjoint and
determent of the matrix.

3 2 1
𝐴= 2 3 1
1 1 4
Matrix
A system of linear equations can be solved using the matrix inversion operation
Let the equations be
•All the variables in the equations should be written
𝑎1 𝑥 + 𝑎2 𝑦 + 𝑎3 𝑧 = 𝑑1 in the appropriate order.
𝑏1 𝑥 + 𝑏2 𝑦 + 𝑏3 𝑧 = 𝑑2 •The variables, their coefficients, and constants are
𝑐1 𝑥 + 𝑐2 𝑦 + 𝑐3 𝑧 = 𝑑3 to be written on the respective sides.

•Matrix A: which represents the


variables
•Matrix B: which represents the
constants

𝑨−𝟏 𝑨𝑿 = 𝑨−𝟏 𝑩
𝑰. 𝑿 = 𝑨−𝟏 𝑩
𝑿 = 𝑨−𝟏 𝑩
Matrix
Example: Solve the following
equations by matrix inversion

2𝑥 + 𝑦 + 2𝑧 = 0
2𝑥 − 𝑦 + 𝑧 = 10
𝑥 + 3𝑦 − 𝑧 = 5
Matrix
Example: Solve the following equations by matrix inversion

2𝑥 + 𝑦 + 2𝑧 = 0
2𝑥 − 𝑦 + 𝑧 = 10
𝑥 + 3𝑦 − 𝑧 = 5
Matrix

Homework: Solve the following using the matrix method


2x1 + x2 + 2x3 + x4 = 6
6x1 - 6x2 + 6x3 + 12x4 = 36
4x1 + 3x2 + 3x3 - 3x4 = – 1
2x1 + 2x2 - x3 + x4 = 10
Matrix
Eigenvalue and Eigenvectors
Eigenvalue: A = [𝑎𝑖𝑗 ] be a square matrix. The characteristic equation
of A is |A-λI | = 0. The roots of the characteristic equation are called
eigenvalues of A.
Eigenvector: A = [𝑎𝑖𝑗 ] be a square matrix of order n. and then if there
exists a non-zero vector X

𝑥1
𝑥2
𝑋= .
.
𝑥𝑛
such that AX = λX , then the vector X is called an Eigenvector of A
corresponding to the Eigenvalue λ.
Matrix
Characteristic equation & Eigen Value
1 2
𝐴= & det(A-λI) = 0
0 2
1 2 1 0
𝑑𝑒𝑡 -λ =0
0 2 0 1
1−λ 2
𝑑𝑒𝑡 =0
0 2−λ
(1 − λ)(2 − λ)-0 = 0
𝝀𝟐 − 𝟑𝝀 + 𝟐 = 𝟎
λ−2 λ−1 =0
Hence, the eigenvalues (λ) are 2 and 1
Matrix
Characteristic equation
The characteristic equation of a 3x3 matrix is λ3 − 𝑆1 λ2 +𝑆2 𝜆 − 𝑆3 = 0
Where, S1= sum of main diagonal elements.
S2 = sum of minor of main diagonal elements.
S3 = Det (A) =|A|
The characteristic equation of a 2x2 matrix is λ2 − 𝑆1 λ+𝑆2 = 0
where, S1 = sum of main diagonal elements.
S2 = Det (A) =|A|
Matrix
Characteristic equation: Problem 1

1 2
𝐴=
0 2

The eigenvalues can be estimated using the roots of the quadratic equation.
−𝑏± 𝑏2 −4𝑎𝑐
λ= In the present case, a = 1, b = -3 and c =2.
2𝑎
When we put these values in the equation above, then the roots are

−(−𝟑) ± (−𝟑)𝟐 −𝟒 × 𝟏 × 𝟐
λ=
𝟐×𝟏
λ = 𝟐, 𝟏(𝑬𝒊𝒈𝒆𝒏 𝒗𝒂𝒍𝒖𝒆𝒔)
Matrix
Characteristic equation: Problem 2

2 −3 1
𝐴= 3 1 3
−5 2 −4

To find the eigenvalues:


−𝑏 ± 𝑏2 − 4𝑎𝑐
λ3 + λ2 − 2λ = 0 λ=
2𝑎
λ(λ2 + λ − 2) = 0 −1 ± (−1)2 −4 × 1 × −2
λ=
2×1
λ=0 𝝀 = 𝟏, −𝟐
𝝀𝟐 + 𝝀 − 𝟐
Matrix
Characteristic equation: Problem 3

1 −1 4
𝐴 = 3 2 −1
2 1 −1

The eigenvalues are 1, -2, and 3.


Matrix
Characteristic equation: Problem 3
Eigenvector: To get the
eigenvector we have to
solve the equation, (A-
λI) = X
Matrix
Characteristic equation: Problem 3
Similarly, we can get the eigenvector for the other two eigenvalues, i.e., λ =
− 2 𝑎𝑛𝑑 3.
−1 1
𝑋2 = 1 and 𝑋3 = 2
1 1
Python Programing
Interpolation: We can estimate the interpolated value using this particular
𝒚𝟐 −𝒚𝟏
equation 𝒚 = 𝒚𝟏 + (𝒙 − 𝒙𝟏 )
𝒙𝟐 −𝒙𝟏
𝑦2 −𝑦1
Slope 𝐦=
𝑥2 −𝑥1
Python Programing
Extrapolation: Same formula, we can use for linear extrapolation.
Python Programing
Polynomial Interpolation: We can fit the polynomial fit on the given data, and
that given function can be used to get the values at a desired location.
Python Programing
Vector Python: horizontal and vertical vectors
Python Programing
Vector Python: Display a vector
Python Programing
Vector Python: Display three vectors
Vector: Computers
Vector Python: add and subtract two vectors
Vector: Computers
Vector Python: dot and cross product of two vectors.
Vector: Computers
Vector Python: dot product of two vectors using for loop

Syntax for loop


Vector: Computers
Vector Python: cross product of two vectors>manual
method.
Vector: Computers
Vector Python: How to calculate and display the curl of a
given function.
Suppose the given function is 𝐹 𝑥, 𝑦, 𝑧 = 𝑥 2 𝑧𝑖 − 𝑥𝑦𝑗 + 𝑧 2 𝑘. We follow this
terminology for the estimation of curl.
x, y, and z would be R[0], R[1], and R[2]. While the unit vectors would be R.x,
R.y, and R.z

In other words, the curl of the given function is 0𝑖 + 𝑦 2 𝑗 + (−2𝑦𝑧 − 𝑦)𝑘


Vector: Computers
Vector Python: How to display the curl of the given
function.
Matrix: Computers
Matrix Python: built a matrix in Python, and component
of matrix
import numpy as np
list_row1 = [5,-10,15]
list_row2 = [3,-6,9]
list_row3 = [-4,8,12]
M1 = [Link]([list_row1,list_row2, list_row3)
Row of any matrix: M1[0], M1[1], M1[2]
Elements of first row: M1[0][0], M1[0][1], M1[0][2]
Elements of second row: M1[1][0], M1[1][1], M1[1][2]
Elements of third row: M1[2][0], M1[2][1], M1[2][2]

Column of the matrix: M1[:, 0], M1[:, 1], and M1[:,2]


Elements of first column: M1[0,0], M1[1,0], M1[2,0]
Elements of second column: M1[0,1], M1[1,1], M1[2,1]
Elements of second column: M1[0,2], M1[1,2], M1[2,2]
Matrix: Computers
Matrix Python: Sum of two matrices in Python.

import numpy as np
M1 = [Link]([[3,6,9],[5,-10,5],[-7,14,21]])
M2 = [Link]([[9,-18,27],[11,22,33],[13,-26,39]])

M3 = M1+M2
print(“The sum matrix is ")
print(M3)
Matrix: Computers
Matrix Python: Difference of two matrices in Python.

import numpy as np
M1 = [Link]([[3,6,9],[5,-10,5],[-7,14,21]])
M2 = [Link]([[9,-18,27],[11,22,33],[13,-26,39]])

M3 = M1-M2

print(“The difference matrix is ")


print(M3)
Matrix: Computers
Matrix Python: Multiplication of two matrices in Python.
import numpy as np
# take a 3x3 matrix
A = [Link]([[12, 7, 3], [4, 5, 6], [7, 8, 9]])

# take a 3x4 matrix


Matrix Multiplication:
B = [Link]([[5, 8, 1, 2], [6, 7, 3, 0],[4, 5, 9, 1]])
Write your code for
matrix multiplication.
# result will be 3x4

result= [Link]([[0,0,0,0], [0,0,0,0], [0,0,0,0]])

result = [Link](A,B)
Print(result)
for r in result:print(r)
Matrix: Computers
Matrix Python: Multiplication of two matrices in Python.
M1 = [Link]([[3, 6, 9], [5, -10, 15], [4,8,12]])
M2 = [Link]()
print(M1) #original matrix
print(M2) #Transpose matrix
Matrix: Computers
Matrix Python: inverse of a matrix in Python.

import numpy as np
A = [Link]([[6, 1, 1], [4, -2, 5], [2, 8, 7]])
B = [Link](A)
print (B)
Matrix: Computers
Matrix Python: built a matrix in Python, and component
of matrix
Matrix: Computers
Matrix Python: Sum of two matrices in Python.

Using the same method, we can determine the difference between the two
matrices. Only use a minus sign instead of a plus sign.
Matrix: Computers
Matrix Python: Multiplication of two matrices in Python.

Home Work: Write


your code for matrix
multiplication for 3
and 4th order matrix
Matrix: Computers
Matrix Python: Transpose and inverse of a matrix in the
Python.
Matrix: Computers
Matrix Python: Multiplication of two matrices in Python.

# Program to multiply two matrices using nested loops


# 3x3 matrix
X = [[12,7,3], [4 ,5,6], [7 ,8,9]]
# 3x4 matrix
Y = [[5,8,1,2], [6,7,3,0], [4,5,9,1]]
# result is 3x4
result = [[0,0,0,0], [0,0,0,0], [0,0,0,0]]

# iterate through rows of X


for i in range(len(X)):
# iterate through columns of Y
for j in range(len(Y[0])):
# iterate through rows of Y
for k in range(len(Y)): result[i][j] += X[i][k] * Y[k][j]
for r in result: print(r)
Matrix: Computers
Matrices: computer
X = [[12,7],
[4 ,5],
[3 ,8]]
result = [[0,0,0],
[0,0,0]]

for i in range(len(X)):
for j in range(len(X[0])):
result[j][i] = X[i][j]

for r in result: print(r)


Vector Operations
Subtraction of vectors: Let a and b be
two vectors. We define a-b as the sum
of the vector a and the vector (- b ). To
subtract b from a, invert the direction
of b and add to a.

Example: Two vectors of equal magnitude 5 units have an angle of 60°


between them. Find the magnitude of (a) the sum of the vectors and (b) the
difference of the vectors.
Vector Operations
Subtraction of vectors: Let a and b be
two vectors. We define a-b as the sum
of the vector a and the vector (- b ). To
subtract b from a, invert the direction
of b and add to a.

Example: Two vectors of equal magnitude 5 units have an angle of 60°


between them. Find the magnitude of (a) the sum of the vectors and (b) the
difference of the vectors.
Frame of Reference
In order to describe the motion of a particle in space, we need to know its position at
different instants of time. If we imagine a coordinate system attached to a rigid body
and we describe the position of any particle relative to it, then such a coordinate
system is called a frame of reference .
𝑟 = 𝑥 𝑖 + 𝑦 𝑗 + z𝑘
𝒓 = 𝒓(𝒕)

The position and time recorded together


constitute an event, represented by four
coordinates (x, y, z, t), and the reference
system, used for this purpose, may be
called a space-time reference system.
Matrix

Different Method for


the inverse of the
matrix.
Matrix operations
3 -3 4

2 -3 4

0 -1 1

Find the inverse of


matrix
Matrices: Gauss-Jordan

A I
Matrices: Gauss-Jordan
Matrices: Gauss-
Jordan
3 3 4

2 -3 4

0 -1 1
Vectors opreations
Unit vector
Vectors operations
Vectors operations
Find the angle between side AC and side AB of a triangle ABC.
Coordinates of the vertices A,B,C are (1+2√3, 1, 2), (1, 1, 2), and
(1,3,2) respectively.
B (1, 1, 2)

A
(1+2√3, 1, 2)
C
(1,3,2)
Vectors operations
Vectors operations
Vectors operations
Find area vector and area that is orthogonal to the plane containing the
points P=(3,0,1), Q=(4,−2,1), and R=(5,3,−1).

Q (4,−2,1)

P (3,0,1)

R (5,3,−1)
Gradient, divergence and curl

f is scalar
Gradient, divergence
φ = x3yz3 and A = xz i – y2 j
and curl
+ 2x2y k
Evaluate
(a)❑φ
(b)❑. A
(c)❑x A
Integral
F = F x i + F y j + Fz k
d r =d x i+dy j+dz k
∫ F . d r = ∫ F x dx + F y dy+ F z dz
c c

For F = (2xy+z3)i + (x2+2y)j +


Calcul ∫(3xz
F . d2-2)k,
r
c
ate
C is the path joining (1,-1,1),
and (2,1,2)
Conservative force
A force is said to be conservative if, work done by the force is
independent of the path taken
P2

W = ∫ F . d r = V (P 2 )−V (P1)
P1

W =∮ F. d r=0

F=−∇ V

∇ x F =0
Vectors: computer
import numpy as np
list1 = [1, 2, 3]

list2 = [[10],
[20],
[30]]
vector1 = [Link](list1) vector2 = [Link](list2)

print("Horizontal Vector") print(vector1)


print("----------------")

print("Vertical Vector") print(vector2)


Vectors: computer
import numpy
as np list1 =
[5, 6, 9]
list2 = [1, 2, 3]
vector1 = [Link](list1)
print("First Vector : " +
str(vector1)) vector2 =
[Link](list2)
print("Second Vector :"+
str(vector2)) addition = vector1
+ vector2
print("Vector Addition :"+
str(addition))
Vectors: computer
import numpy
as np list1 =
[5, 6, 9]
list2 = [1, 2, 3]
vector1 = [Link](list1)
print("First Vector : " +
str(vector1)) vector2 =
[Link](list2)
print("Second Vector :"+
str(vector2)) addition = vector1
+ vector2
print("Vector Addition :"+
str(addition)) subtraction =
vector1 - vector2
print("Vector Substraction : " +
str(subtraction))
Vectors: computer
import numpy
as np list1 =
[5, 6, 9]
list2 = [1, 2, 3]
vector1 = [Link](list1)
print("First Vector : " +
str(vector1)) vector2 =
[Link](list2)
print("Second Vector :"+
str(vector2)) addition = vector1
+ vector2
print("Vector Addition :"+
str(addition)) subtraction =
vector1 - vector2
print("Vector Substraction : " +
str(subtraction))
multiplication = vector1 * vector2
print("Vector Multiplication : " +
str(multiplication)) division = vector1
/ vector2
print("Vector Division :"+
str(division))
Vectors: computer
import numpy
as np list1 =
[5, 6, 9]
list2 = [1, 2, 3]
vector1 = [Link](list1)
print("First Vector : " +
str(vector1)) vector2 =
[Link](list2)
print("Second Vector : " +
str(vector2)) dot_product =
[Link](vector2)
print("Dot Product : " +
str(dot_product))
Frame of Reference

We have learned about


velocity, acceleration, and
displacement. But all
these quantities need a In physics, a frame of reference
frame of reference from consists of an abstract coordinate
which they are measured.
system and the set of physical reference points
that uniquely fix the coordinate system and
standardize measurements within that frame.
Frame of Reference
Scaler and Vector
Scalar Vector
Scalar quantity has only magnitude, but Vector quantity has both magnitude
no direction and direction.

Scalar quantities follow the rules of Vector quantity follows the rules of
ordinary algebra. vector algebra.

Divison of scalar with scalar is Division between the vectors is


not permitted.
permitted.

Example: Mass, length, and energy Example: Force, displacement,


and weight etc.
etc.

You might also like