R Lab3
R Lab3
Date: ..../....../......
Lab Sheet 3
Linear Algebra using R
Aim
• To perform linear algebra in R environment
Introduction
Linear algebra in data science refers to the use of mathematical concepts involving
vectors, matrices, and linear transformations to manipulate and analyze data. It
provides useful tools for most algorithms and processes in data science, such as
machine learning, statistics, and big data analytics. It turns theoretical data models
into practical solutions that can be applied in real-world situations.
Exercises
1. Vectors: Perform the following functions: Create one hori-
zontal and vertical vector. Perform the arithmetic operations
on them: vector addition, subtraction, Multiplication and di-
vision, vector dot product, cross product, L1 Norm, L2 Norm,
L∞ Norm
Figure 1
Figure 2
Figure 3
0.0.3 Inference
The determinant of a matrix is calculated using det(A), and the adjoint (inverse
multiplied by determinant) is computed using solve(A) * det(A).
(a) LU (b) QR
Figure 4
Figure 5
Figure 6
Question
1. What is the application of linear algebra in data science
and machine learning
0.0.7 Ans: Linear algebra is widely used in data science and machine
learning for representing and processing data efficiently. Datasets
are often stored as matrices, and operations like matrix multipli-
cation and decomposition help in feature transformation, dimen-
sionality reduction (PCA), and optimization (gradient descent).
Algorithms like neural networks and support vector machines rely
heavily on vector spaces, matrix factorization, and eigenvalues to
extract meaningful patterns from data.
Evaluation
Participation Knowledge Results Conduct Report Ethics Total