Skip to content
Justice Tech School

Norms and Distances

np.linalg.norm measures vector length. The distance between points is the norm of their difference.

Example
import numpy as np
v = np.array([3, 4])
print(np.linalg.norm(v))
p, q = np.array([0, 0]), np.array([6, 8])
print(np.linalg.norm(p - q))

Result

5.0
10.0

Exercise

Length of a vector.

np.linalg.(v)

Quiz Test

What is the norm of [3, 4]?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.