Linear Algebra
Linear Algebra
Grades A A- B+ B B- C+ C D NP
Marks 90-100 80-89 70-79 60-69 50-59 40-49 35-39 30-34 0-29
Range
Linear Algebra
Linear
having to do with lines/planes/etc.
For example, x + y + 3z = 7, not sin, log, x 2 , etc.
Algebra
solving equations involving numbers and symbols
from al-jebr (Arabic), meaning reunion of broken parts
9 th century Abu Ja’far Muhammad ibn Muso al-Khwarizmi
Linear algebra is the branch of mathematics that studies vectors, vector spaces, and linear
transformations.
It helps solve problems involving systems of linear equations and describes geometric
concepts like lines and planes.
| 4
Linear Algebra
But these are the easiest kind of equations! I learned how to solve them in 7th grade! Ah, but engineers need to solve lots
of equations in lots of variables
Often, it’s enough to know some information about the set of solutions without having to solve the equations at all!
Also, what if one of the coefficients of the xi is itself a parameter— like an unknown real number t?
In real life, the difficult part is often in recognizing that a problem can be solved using linear algebra in the first place: need
conceptual understanding.
| 5
Introduction to
Objective: Understand the basicvectors
concept of vectors and how to represent them in MATLAB.
Concepts:
Definition of a Vector: A vector is an ordered list of numbers representing a point in space, direction, or magnitude.
Array: In MATLAB, an array is a fundamental data type used to store collections of data elements. Arrays in MATLAB can
be multidimensional and are used to perform a wide variety of numerical computations.
MATLAB Examples:
Activity:
Have students create their own row and column vectors in MATLAB. | 6
Introduction to Vectors
Creating Vectors
1. Using Square Brackets
v = [1 2 3 4 5]; % Row vector
v = [1; 2; 3; 4; 5]; % Column vector
Visualizing Vectors
Plotting
x = 1:10;
y = 2*x;
plot(x, y); % Plots y = 2*x
Activity:
Have students create their vectors, access specific elements from these vectors, and then plot them using MATLAB.
| 7
Basic Operations with Vectors
Objective: Perform basic vector operations in MATLAB, including addition, subtraction, and scalar multiplication.
Concepts:
Definition of a Vector: A vector is an ordered list of numbers representing a point in space, direction, or magnitude.
MATLAB Examples:
% Define vectors
u = [2, 3];
v = [4, 5];
% Addition
sum_vec = u + v;
% Subtraction
diff_vec = u - v;
% Scalar Multiplication
scalar = 3;
scaled_vec = scalar * u;
Activity:
Provide a set of vectors and scalars for students to perform addition, subtraction, and scalar multiplication in MATLAB.
| 8
Dot Product and Its Applications
Objective: Calculate the dot product of vectors and understand its geometric meaning using MATLAB.
Concepts:
Dot Product Formula: u⃗ ⋅v⃗ =u1.v1+u2.v2
Geometric Interpretation: Related to the cosine of the angle between vectors.
MATLAB Examples:
% Define vectors
u = [1, 3];
v = [4, -2];
% Dot Product
dot_product = dot(u, v);
Activity:
Students calculate dot products and angles between vectors in MATLAB. Discuss the results and their geometric
interpretations.
| 9
Vector Magnitude and Normalization
Objective: Compute the magnitude of vectors and normalize them using MATLAB.
Concepts:
Magnitude of a Vector:
MATLAB Examples:
% Define vector
v = [3, 4];
% Magnitude
magnitude_v = norm(v);
% Normalization
normalized_v = v / magnitude_v;
Activity:
Have students calculate the magnitude and normalized version of various vectors in MATLAB.
| 10
Vector Spaces and Basis Vectors
Objective: Explore vector spaces and basis vectors in MATLAB.
Concepts:
Vector Space: A collection of vectors where addition and scalar multiplication are defined.
Basis Vectors: A set of vectors that span the space and are linearly independent.
Dimension: The number of vectors in a basis set.
MATLAB Examples:
% Define vectors
v1 = [1; 0];
v2 = [0; 1];
% Basis vectors in 2D
basis = [1, 0; 0, 1];
Activity:
Students verify whether given sets of vectors form a basis in MATLAB and determine the dimension of the vector space.
| 11
Assignment-1
Try out the following without the semicolon at the command prompt
a = [1 4 3 2];
Convert a row vector to column vector
b = a';
Extract 1st and 2nd element of “a” vector
c = a(1);
d = a(2);
e = a(2:end);
Find a f = a(-1) vector?
Find sum of all elements of a?
g = sum(a);
1.V(3);
2.V([1 5 6]);
3.V(3:7);
4.V2= V([5:8 1:4]);
5.V(end);
6.V(5:end);
7.V(2:end-1);
8.V(1:2:end);
9.V(end:-1:1);
10.V([2 3 4])=[10 15 20];
11.V([2 3])=30;