## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Computing the norm and determinant

This subsection will introduce two important values in linear algebra, namely the norm and determinant. Briefly, the norm gives length of a vector. The most commonly used norm is the L2-norm, which is also known as the Euclidean norm. Formally, the Lp-norm of x is calculated as follows:

The L0-norm is actually the cardinality of a vector. You can calculate it by just counting the total number of non-zero elements. For example, the vector A =[2,5,9,0] contains three non-zero elements, therefore ||A||0 = 3The following code block shows the same norm calculation with numpy:

`In [24]: import numpy as np  x = ...`

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required