Skip to content

Binary Variable

Definition

A binary variable is a decision variable restricted to {0,1}\{0,1\}. For a yes-or-no choice jj, the course convention is

yj={1,if decision j is yes,0,if decision j is no.y_j=\begin{cases}1,&\text{if decision }j\text{ is yes},\\0,&\text{if decision }j\text{ is no}.\end{cases}

Interpretation

A binary variable turns a yes-or-no decision into a number, 1 for yes and 0 for no, so that the decision can appear in linear objectives and constraints. Its practical meaning must be stated explicitly: which decision it describes and which value means yes.

A number line from 0 to 1 with the two allowed values of a binary variable as filled points, 0 for no and 1 for yes, and the whole interval shaded as its relaxation.

Only the two endpoints are allowed values. The light band between them is the relaxation 0≤y≤10\le y\le1, which also admits values such as 0.40.4 that correspond to no decision at all.

The 0–1 coding gives linear expressions a logical meaning. The sum ∑jyj\displaystyle \sum_jy_j counts the yes decisions, ∑jcjyj\displaystyle \sum_jc_jy_j adds up the costs cjc_j of the chosen alternatives only, y1+y2≤1y_1+y_2\le1 allows at most one of two alternatives, and y2≤y1y_2\le y_1 allows alternative 2 only if alternative 1 is chosen.


Key Results

  • The continuous bounds 0≤yj≤10\le y_j\le1 alone do not enforce binarity.
  • Summing binary variables counts the selected decisions.
  • Auxiliary binary variables can activate or relax constraints.

Examples

The red points are the allowed values 0 and 1; the shaded interval belongs to the continuous relaxation.

  • A station-location variable is 1 exactly when an ambulance station is built in that town.
  • y1+y2≤1y_1+y_2\le1 prohibits selecting both alternatives.

Prerequisites

Sources

Aliases: 0-1 variable, binary decision variable, zero-one variable Symbols: sum

Last updated: 20 October 2026 03:02