{
  "id": "free-variable",
  "title": "Free Variable",
  "lang": "en",
  "source_lang": "en",
  "summary": "A free variable is a variable occurrence not governed by a binding operator; in linear algebra, it is an unknown that can be chosen as a solution parameter.",
  "category": "mathematics",
  "subcategory": "discrete-logic",
  "type": "concept",
  "aliases": [
    "Free parameter"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/free-variable/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/free-variable/",
      "json": "https://aiwiki.page/zh/free-variable.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A free variable is a variable that is not bound by an operator within the expression under consideration. In logic, a variable occurrence is free when it lies outside the scope of a quantifier or other operator that binds that variable. Its interpretation is supplied by an assignment or a surrounding context. In linear algebra, the term has a related but distinct meaning: a free variable is an unknown that can be chosen independently when parameterizing the solutions of a consistent linear system. Freedom is therefore relative to an expression, a binding context, or a system of constraints—not an intrinsic property of a variable name."
    },
    {
      "heading": "Free and bound occurrences",
      "text": "The distinction between free and bound variables is most precisely a distinction between occurrences of variables. In first-order logic, the universal quantifier \\(\\forall x\\) and the existential quantifier \\(\\exists x\\) bind occurrences of \\(x\\) within their scopes, except where those occurrences are governed by an intervening quantifier for the same variable.\n\nFor example, in\n\n\\[\\forall x\\,R(x,y),\\]\n\nthe occurrence of \\(x\\) in \\(R(x,y)\\) is bound, while the occurrence of \\(y\\) is free. The formula says that every object stands in relation \\(R\\) to the object assigned to \\(y\\).\n\nA single variable name can have both free and bound occurrences in the same formula:\n\n\\[P(x)\\land \\exists x\\,Q(x).\\]\n\nThe occurrence of \\(x\\) in \\(P(x)\\) is free; the occurrence in \\(Q(x)\\) is bound by \\(\\exists x\\). The quantifier does not extend backward over the first conjunct.\n\nFreedom also depends on which expression is being considered. The variable \\(x\\) is free in the subformula \\(R(x,y)\\), but it is bound when that subformula occurs within \\(\\forall x\\,R(x,y)\\).\n\nA formula with no free variables is called a sentence or closed formula. A formula with at least one free variable is commonly called an open formula. “Closed” does not mean “true”: a closed formula may be true or false in a given interpretation."
    },
    {
      "heading": "Formal definition",
      "text": "The set of free variables of an expression \\(E\\) is usually written \\(\\operatorname{FV}(E)\\). For ordinary first-order syntax, it is defined recursively.\n\nFor terms:\n\n- If \\(x\\) is a variable, then \\(\\operatorname{FV}(x)=\\{x\\}\\).\n- If \\(c\\) is a constant symbol, then \\(\\operatorname{FV}(c)=\\varnothing\\).\n- If \\(f\\) is an \\(n\\)-argument function symbol, then\n\n\\[\\operatorname{FV}(f(t_1,\\ldots,t_n)) = \\bigcup_{i=1}^{n}\\operatorname{FV}(t_i).\\]\n\nFor formulas, the free variables of an atomic formula are the variables occurring in its argument terms. Negation preserves the set of free variables, and binary logical connectives take unions:\n\n\\[\\operatorname{FV}(\\neg\\varphi) = \\operatorname{FV}(\\varphi),\\]\n\n\\[\\operatorname{FV}(\\varphi\\land\\psi) = \\operatorname{FV}(\\varphi)\\cup\\operatorname{FV}(\\psi).\\]\n\nThe same union rule applies to disjunction and implication. Quantifiers remove their bound variable:\n\n\\[\\operatorname{FV}(\\forall x\\,\\varphi) = \\operatorname{FV}(\\varphi)\\setminus\\{x\\},\\]\n\n\\[\\operatorname{FV}(\\exists x\\,\\varphi) = \\operatorname{FV}(\\varphi)\\setminus\\{x\\}.\\]\n\nFor example,\n\n\\[\\operatorname{FV}\\bigl(\\forall x\\,(R(x,y)\\to\\exists z\\,S(z,x,w))\\bigr) = \\{y,w\\}.\\]\n\nThese rules describe syntactic freedom. A variable can occur freely even when changing its assigned value never changes the formula’s truth value. For example, \\(x\\) is free in \\(x=x\\), although this formula is true under every assignment in ordinary first-order logic with equality."
    },
    {
      "heading": "Interpretation and truth",
      "text": "In model theory, evaluating a formula generally requires both a structure \\(\\mathcal M\\), which interprets its nonlogical symbols, and a variable assignment \\(s\\), which assigns domain elements to variables. The notation\n\n\\[\\mathcal M,s\\models\\varphi\\]\n\nmeans that \\(\\varphi\\) is satisfied in \\(\\mathcal M\\) under \\(s\\).\n\nOnly the values assigned to free variables can affect satisfaction. More precisely, if assignments \\(s\\) and \\(s'\\) agree on every variable in \\(\\operatorname{FV}(\\varphi)\\), then\n\n\\[\\mathcal M,s\\models\\varphi \\quad\\Longleftrightarrow\\quad \\mathcal M,s'\\models\\varphi.\\]\n\nA sentence therefore has a truth value in a structure independently of the variable assignment.\n\nAn open formula can describe a relation or, more generally, a set of tuples. Over the real numbers, the formula\n\n\\[x+y=0\\]\n\ndefines the pairs \\((a,b)\\) satisfying \\(a+b=0\\). Binding one variable changes the statement:\n\n\\[\\exists y\\,(x+y=0)\\]\n\nis satisfied by every real value assigned to \\(x\\), whereas\n\n\\[\\forall y\\,(x+y=0)\\]\n\nis satisfied by none.\n\nFree variables are also relevant to restrictions on logical rules of inference. In natural deduction, universal introduction requires conditions ensuring that the generalized variable does not depend on an undischarged assumption. Without such conditions, a claim about a particular assigned object could incorrectly become a claim about every object."
    },
    {
      "heading": "Substitution and variable capture",
      "text": "Substitution replaces free occurrences of a variable with a term. It must preserve the distinction between free and bound occurrences.\n\nSuppose\n\n\\[\\varphi=\\exists y\\,R(x,y).\\]\n\nNaively replacing \\(x\\) with \\(y\\) produces\n\n\\[\\exists y\\,R(y,y).\\]\n\nThe inserted \\(y\\), intended to remain free, has instead become bound. This is variable capture, and it generally changes the intended meaning.\n\nCapture-avoiding substitution first renames the bound variable to a fresh name:\n\n\\[\\exists y\\,R(x,y) \\quad\\rightsquigarrow\\quad \\exists z\\,R(x,z).\\]\n\nReplacing \\(x\\) with \\(y\\) can then safely yield\n\n\\[\\exists z\\,R(y,z).\\]\n\nA consistent renaming of a bound variable that avoids capture is called alpha-renaming. Expressions differing only by such renamings are alpha-equivalent. Thus \\(\\forall x\\,P(x)\\) and \\(\\forall z\\,P(z)\\) are alpha-equivalent, whereas \\(P(x)\\) and \\(P(z)\\) generally are not: their free variables refer to potentially different assigned objects."
    },
    {
      "heading": "Binding in mathematical notation",
      "text": "Binding occurs throughout mathematics, not only in quantified formulas. In a definite integral,\n\n\\[\\int_0^1 f(x,a)\\,dx,\\]\n\n\\(x\\) is the bound integration variable, while \\(a\\) remains a free parameter, assuming no surrounding binder governs it. Renaming the integration variable to a fresh symbol leaves the integral unchanged:\n\n\\[\\int_0^1 f(t,a)\\,dt.\\]\n\nSimilarly, in\n\n\\[\\sum_{i=1}^{n}a_i,\\]\n\n\\(i\\) is a bound index, while \\(n\\) and the data represented by \\(a\\) come from the surrounding context.\n\nIn set theory, the variable \\(x\\) is bound in the set-builder expression\n\n\\[\\{x\\in A:P(x,y)\\},\\]\n\nwhile \\(y\\) is free unless bound elsewhere. The resulting set can therefore depend on the value assigned to \\(y\\).\n\nThese examples show why a bound variable is often called a dummy variable: its name can be changed without changing the object denoted, provided the renaming respects scope and avoids capture."
    },
    {
      "heading": "Lambda calculus and programming languages",
      "text": "In lambda calculus, an abstraction \\(\\lambda x.M\\) binds \\(x\\) in its body \\(M\\). The free-variable rules are\n\n\\[\\operatorname{FV}(MN) = \\operatorname{FV}(M)\\cup\\operatorname{FV}(N),\\]\n\n\\[\\operatorname{FV}(\\lambda x.M) = \\operatorname{FV}(M)\\setminus\\{x\\}.\\]\n\nFor example,\n\n\\[\\operatorname{FV}(\\lambda x.\\,x\\,y)=\\{y\\}.\\]\n\nA lambda term with no free variables is called a closed term. Capture-avoiding substitution is essential to the reduction rule\n\n\\[(\\lambda x.M)\\,N\\longrightarrow M[x:=N].\\]\n\nIn programming languages, a variable may be free relative to a function body while being bound in an enclosing scope. Under lexical scoping, a function such as an anonymous function representing \\(x\\mapsto x+y\\) takes \\(x\\) as a parameter and obtains \\(y\\) from its enclosing environment. A closure associates executable function code with the environment needed for such references.\n\nThus, “free variable” does not necessarily mean “undefined variable.” The variable may have a valid binding outside the expression currently being examined."
    },
    {
      "heading": "Free variables in linear systems",
      "text": "In a system of linear equations\n\n\\[A\\mathbf x=\\mathbf b,\\]\n\nfree variables are coordinates not associated with pivot columns after Gaussian elimination has put the coefficient matrix into row-echelon form. For a consistent system, these variables can be chosen arbitrarily from the underlying field, and the pivot variables are then determined by them.\n\nFor example,\n\n\\[x+2y-z=3\\]\n\ncan be parameterized by taking \\(y=s\\) and \\(z=t\\):\n\n\\[(x,y,z)=(3-2s+t,\\ s,\\ t).\\]\n\nHere \\(y\\) and \\(z\\) serve as free variables. Unlike logical freedom, this concerns the relationships imposed by equations rather than the scope of a binder.\n\nIf \\(A\\) has \\(n\\) columns and rank \\(r\\), there are \\(n-r\\) free variables in its standard row-echelon parameterization. By the rank–nullity theorem, this is the dimension of the null space of \\(A\\).\n\nWhen the system is consistent, its solution set has the form\n\n\\[\\mathbf x=\\mathbf x_p+\\mathbf v, \\qquad \\mathbf v\\in\\ker A,\\]\n\nwhere \\(\\mathbf x_p\\) is one particular solution. It is an affine space with \\(n-r\\) independent parameters.\n\nThe choice of free coordinates can change if the unknowns are reordered or another parameterization is used; their number does not. Moreover, an inconsistent system has no solution, even if its coefficient matrix has nonpivot columns. In that case, nonpivot unknowns do not parameterize any solutions."
    }
  ],
  "links": [
    "logic",
    "linear-algebra",
    "first-order-logic",
    "model-theory",
    "binary-relation",
    "real-number",
    "inference-rule",
    "natural-deduction",
    "mathematics",
    "integral",
    "set-theory",
    "lambda-calculus",
    "system-of-linear-equations",
    "gaussian-elimination",
    "field-mathematics",
    "matrix-rank",
    "rank-nullity-theorem",
    "null-space",
    "affine-space"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}