{
  "id": "linear-independence",
  "version": "964ab03a3e98",
  "status": "published",
  "name": "Linear Independence Calculator",
  "question": "Test vectors for linear independence",
  "summary": "Checks whether vectors are linearly independent by the rank of the matrix with the vectors as columns, in exact fractions, and gives a dependence relation when they are not.",
  "category": "math",
  "subcategory": "linear-algebra",
  "url": "https://www.acalculator.org/math/linear-independence-calculator",
  "markdown": "https://www.acalculator.org/math/linear-independence-calculator.md",
  "kind": "function",
  "method": "Put the vectors in the columns of a matrix and reduce it to RREF. They are independent exactly when every column has a pivot (rank = number of vectors). Otherwise the first column without a pivot, j, gives v_j = Σ R[row][j] × v_p over the earlier pivot columns p.",
  "assumptions": [
    "Every entry is read as an exact fraction: a decimal such as 0.1 is 1/10, so there is no rounding.",
    "There are 1 to 10 vectors, all with the same number of entries, from 1 to 10."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "v": {
        "title": "Vectors (one per row)",
        "description": "The vectors v₁, v₂, …, one per row: 1 to 10 vectors with 1 to 10 entries each.",
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "number"
          }
        }
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Independent or dependent",
      "description": "Whether the vectors are linearly independent, with the rank and the number of vectors.",
      "format": "text"
    },
    "relation": {
      "label": "Dependence relation",
      "description": "For dependent vectors: the first vector that is a combination of the vectors before it.",
      "format": "text"
    },
    "rank": {
      "label": "Rank",
      "description": "The number of pivots: how many of the vectors are independent.",
      "format": "integer"
    },
    "count": {
      "label": "Number of vectors",
      "description": "How many vectors you typed.",
      "format": "integer"
    },
    "pivots": {
      "label": "Independent vectors",
      "description": "The vectors whose columns hold a pivot: they are independent and span the same space as all the vectors.",
      "format": "text"
    },
    "rref": {
      "label": "RREF of the matrix [v₁ v₂ …]",
      "description": "The reduced row echelon form of the matrix with the vectors as columns, rows separated by semicolons.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "v": [
        [
          1,
          2,
          3
        ],
        [
          4,
          5,
          6
        ],
        [
          7,
          8,
          9
        ]
      ]
    },
    "outputs": {
      "result": "Linearly dependent (rank 2 < 3 vectors)",
      "relation": "v₃ = −v₁ + 2v₂",
      "rank": 2,
      "count": 3,
      "pivots": "v₁, v₂",
      "rref": "[1, 0, −1; 0, 1, 2; 0, 0, 0]"
    },
    "text": "Linearly dependent (rank 2 < 3 vectors)."
  },
  "examples": [
    {
      "given": {
        "v": [
          [
            1,
            2,
            3
          ],
          [
            4,
            5,
            6
          ],
          [
            7,
            8,
            9
          ]
        ]
      },
      "expect": {
        "result": "Linearly dependent (rank 2 < 3 vectors)",
        "relation": "v₃ = −v₁ + 2v₂",
        "rank": 2,
        "pivots": "v₁, v₂"
      },
      "source": "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence (a set is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with the vectors as columns has a pivot in every column; a wide matrix has dependent columns; a nonzero solution of Ax = 0 gives a dependence relation), https://textbooks.math.gatech.edu/ila/linear-independence.html (retrieved 2026-10-19); MIT OpenCourseWare 18.06 Linear Algebra (Gilbert Strang), Lecture 7: Solving Ax = 0: pivot variables, special solutions (counting the pivots gives the rank), https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/resources/lecture-7-solving-ax-0-pivot-variables-special-solutions/ (retrieved 2026-10-19); hand calculation in content.mdx: 2 × [4, 5, 6] − [1, 2, 3] = [7, 8, 9]"
    },
    {
      "given": {
        "v": [
          [
            1,
            0,
            0
          ],
          [
            1,
            1,
            0
          ],
          [
            1,
            1,
            1
          ]
        ]
      },
      "expect": {
        "result": "Linearly independent (rank 3 = 3 vectors)",
        "rank": 3,
        "rref": "[1, 0, 0; 0, 1, 0; 0, 0, 1]"
      },
      "source": "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence (a set is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with the vectors as columns has a pivot in every column; a wide matrix has dependent columns; a nonzero solution of Ax = 0 gives a dependence relation), https://textbooks.math.gatech.edu/ila/linear-independence.html (retrieved 2026-10-19); hand calculation in content.mdx: a pivot in every column"
    },
    {
      "given": {
        "v": [
          [
            1,
            2
          ],
          [
            3,
            4
          ],
          [
            5,
            6
          ]
        ]
      },
      "expect": {
        "result": "Linearly dependent (rank 2 < 3 vectors)",
        "relation": "v₃ = −v₁ + 2v₂"
      },
      "source": "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence (a set is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with the vectors as columns has a pivot in every column; a wide matrix has dependent columns; a nonzero solution of Ax = 0 gives a dependence relation), https://textbooks.math.gatech.edu/ila/linear-independence.html (retrieved 2026-10-19); hand calculation in content.mdx: −[1, 2] + 2 × [3, 4] = [5, 6]"
    },
    {
      "given": {
        "v": [
          [
            2,
            4
          ],
          [
            1,
            2
          ]
        ]
      },
      "expect": {
        "result": "Linearly dependent (rank 1 < 2 vectors)",
        "relation": "v₂ = (1/2)v₁"
      },
      "source": "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence (a set is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with the vectors as columns has a pivot in every column; a wide matrix has dependent columns; a nonzero solution of Ax = 0 gives a dependence relation), https://textbooks.math.gatech.edu/ila/linear-independence.html (retrieved 2026-10-19); hand calculation in content.mdx: [1, 2] = ½ × [2, 4]"
    },
    {
      "given": {
        "v": [
          [
            1,
            2,
            3
          ],
          [
            0,
            0,
            0
          ]
        ]
      },
      "expect": {
        "result": "Linearly dependent (rank 1 < 2 vectors)",
        "relation": "v₂ = 0"
      },
      "source": "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence (a set is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with the vectors as columns has a pivot in every column; a wide matrix has dependent columns; a nonzero solution of Ax = 0 gives a dependence relation), https://textbooks.math.gatech.edu/ila/linear-independence.html (retrieved 2026-10-19); hand calculation in content.mdx: v₂ = 0 × v₁"
    },
    {
      "given": {
        "v": [
          [
            3,
            -1
          ]
        ]
      },
      "expect": {
        "result": "Linearly independent (rank 1 = 1 vector)"
      },
      "source": "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence (a set is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with the vectors as columns has a pivot in every column; a wide matrix has dependent columns; a nonzero solution of Ax = 0 gives a dependence relation), https://textbooks.math.gatech.edu/ila/linear-independence.html (retrieved 2026-10-19); hand calculation in content.mdx: one nonzero vector is independent"
    }
  ],
  "sources": [
    "Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra (Georgia Institute of Technology), §2.5 Linear Independence: a set of vectors is linearly independent when x₁v₁ + … + x_kv_k = 0 has only the trivial solution; this holds exactly when the matrix with those columns has a pivot in every column; a wide matrix has linearly dependent columns; solving Ax = 0 with nonzero free variables gives a linear dependence relation, retrieved 2026-10-19. https://textbooks.math.gatech.edu/ila/linear-independence.html",
    "MIT OpenCourseWare 18.06 Linear Algebra (Gilbert Strang), Lecture 7: Solving Ax = 0: pivot variables, special solutions (counting the pivots gives the rank), retrieved 2026-10-19. https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/resources/lecture-7-solving-ax-0-pivot-variables-special-solutions/"
  ],
  "related": [
    "null-space",
    "rref",
    "gram-schmidt",
    "determinant"
  ],
  "changelog": []
}
