Evaluate an Expression

Pre-Algebra

Evaluating an expression means substituting specific values for variables and calculating the resulting numerical value.

Definition

To evaluate an expression, you replace each variable with a given number and then calculate the answer, following the order of operations (PEMDAS) to reduce everything to a single value. Formally, evaluation is the map from expressions to values given a variable assignment (a valuation or interpretation): if $E$ is an expression over variables $x_1, \ldots, x_n$ and $v$ is a valuation mapping each $x_i$ to a value in domain $D$, then $\mathrm{eval}(E, v)$ is the value of $E$ under $v$; in lambda calculus, evaluation is beta reduction of an applied lambda term.

Example

Evaluate $4x + 3$ when $x = 5$: replace $x$ with $5$ to get $4(5) + 3 = 20 + 3 = 23$. Evaluate $3x^2 - 2y + 1$ for $x = 4$ and $y = -3$: substitute to get $3(16) - 2(-3) + 1 = 48 + 6 + 1 = 55$. For the polynomial $p(x, y) = x^3 - 2xy + y^2$, the evaluation at the point $(2, 3)$ is $p(2, 3) = 8 - 12 + 9 = 5$.

Key Insight

Evaluating an expression is like following a recipe: the variable is an ingredient, and the given value tells you how much of it to use. Careful substitution into the order of operations is essential, since a common error is forgetting to apply the exponent before multiplying by the coefficient. Evaluating polynomials efficiently uses Horner's method, $p(x) = a_0 + x(a_1 + x(a_2 + \ldots + xa_n))$, reducing $n^2$ multiplications to $n$, an important trick in numerical computing.