Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Linear Algebra Basic | Master Data Science with Python lesso | BraveProgrammer
  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 12 of 60

·python

Linear Algebra Basics with NumPy

30 minutes

Course progress20%

Linear Algebra Basics

Linear algebra is at the heart of many data‑science algorithms (e.g., PCA, regression).

Why it matters

  • Vectors represent features.
  • Matrices represent data tables or transformations.

Performing basic operations

import numpy as np

# Dot product (vector)
v = np.array([, , ])
w = np.array([, , ])
(, np.dot(v, w))   


A = np.array([[, ], [, ]])
B = np.array([[, ], [, ]])
C = A @ B
(, C)
1
2
3
4
5
6
print
'Dot:'
# or v @ w
# Matrix multiplication
1
2
3
4
5
6
7
8
print
'A @ B = '

Solving linear systems

A = np.array([[3, 1], [1, 2]])
b = np.array([9, 8])
solution = np.linalg.solve(A, b)
print('Solution:', solution)

Eigenvalues & eigenvectors

vals, vecs = np.linalg.eig(A)
print('Eigenvalues:', vals)
print('Eigenvectors:
', vecs)

Singular Value Decomposition (SVD)

U, S, VT = np.linalg.svd(A)
print('U:
', U)
print('S:', S)
print('VT:
', VT)

Info

Standardize data before PCA – otherwise scale dominates the components.
Make it stickPractice what you've learned1 quiz · 4 practical tests · Optional activities from Master Data Science with PythonBrowse activities
Previous lessonRandom Sampling and Statistics with NumPyContinue to lesson 13Advanced NumPy: Masking, Fancy Indexing, and Structured ArraysBack to Master Data Science with Python curriculum