nullspace

nullspace(M)

Basis for nullspace of M.

Examples

In the Julia programming language, the function nullspace(M)

Compute a basis for the nullspace of matrix M.

julia> M = [1 2 3; 4 5 6; 7 8 9];
julia> nullspace(M)
3×1 Array{Float64,2}:
 -0.40824829046386296
 -0.8164965809277263
  0.4082482904638631

Provide common examples of its use:

  1. Find the nullspace of a matrix:

    julia> A = [1 2 3; 4 5 6; 7 8 9];
    julia> nullspace(A)
    3×1 Array{Float64,2}:
    -0.40824829046386296
    -0.8164965809277263
     0.4082482904638631

    This example computes a basis for the nullspace of matrix A.

  2. Solve a system of linear equations:
    julia> B = [1 2 3 4; 5 6 7 8; 9 10 11 12];
    julia> nullspace(B)
    4×1 Array{Float64,2}:
    -0.2366322821299352
     0.4714045207910337
    -0.7071067811865475
     0.4714045207910339

    In this example, the nullspace of matrix B is computed, which can be useful for solving systems of linear equations.

Common mistake example:

julia> C = [1 2 3; 4 5 6]
julia> nullspace(C)
ERROR: ArgumentError: expected a 2-dimensional array

In this example, the input matrix C is not a 2-dimensional array. The nullspace function expects a 2-dimensional matrix as its argument. Make sure to provide a valid matrix to the function to avoid this error.

See Also

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: