In
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, an expression or mathematical expression is a finite combination of
symbols
A symbol is a mark, sign, or word that indicates, signifies, or is understood as representing an idea, object, or relationship. Symbols allow people to go beyond what is known or seen by creating linkages between otherwise very different conc ...
that is
well-formed according to rules that depend on the context. Mathematical symbols can designate numbers (
constants),
variables,
operation
Operation or Operations may refer to:
Arts, entertainment and media
* ''Operation'' (game), a battery-operated board game that challenges dexterity
* Operation (music), a term used in musical set theory
* ''Operations'' (magazine), Multi-Man ...
s,
functions,
bracket
A bracket is either of two tall fore- or back-facing punctuation marks commonly used to isolate a segment of text or data from its surroundings. Typically deployed in symmetric pairs, an individual bracket may be identified as a 'left' or 'r ...
s, punctuation, and grouping to help determine
order of operations
In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.
For exampl ...
and other aspects of
logical syntax
In logic, syntax is anything having to do with formal languages or formal systems without regard to any interpretation or meaning given to them. Syntax is concerned with the rules used for constructing, or transforming the symbols and words of ...
.
Many authors distinguish an expression from a ''
formula
In science, a formula is a concise way of expressing information symbolically, as in a mathematical formula or a ''chemical formula''. The informal use of the term ''formula'' in science refers to the general construct of a relationship betwee ...
'', the former denoting a
mathematical object, and the latter denoting a statement about mathematical objects. For example,
is an expression, while
is a formula. However, in modern mathematics, and in particular in
computer algebra
In mathematics and computer science, computer algebra, also called symbolic computation or algebraic computation, is a scientific area that refers to the study and development of algorithms and software for manipulating mathematical expressions ...
, formulas are viewed as expressions that can be evaluated to ''true'' or ''false'', depending on the values that are given to the variables occurring in the expressions. For example
takes the value ''false'' if is given a value less than –1, and the value ''true'' otherwise.
Examples
The use of expressions ranges from the simple:
::
::
(
linear polynomial)
::
(
quadratic polynomial)
::
(
rational fraction)
to the complex:
::
Syntax versus semantics
Syntax
An expression is a syntactic construct. It must be
well-formed: the allowed
operator
Operator may refer to:
Mathematics
* A symbol indicating a mathematical operation
* Logical operator or logical connective in mathematical logic
* Operator (mathematics), mapping that acts on elements of a space to produce elements of another ...
s must have the correct number of inputs in the correct places, the characters that make up these inputs must be valid, have a clear
order of operations
In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.
For exampl ...
, etc. Strings of symbols that violate the rules of syntax are not well-formed and are not valid mathematical expressions.
For example, in the
usual notation of
arithmetic
Arithmetic () is an elementary part of mathematics that consists of the study of the properties of the traditional operations on numbers— addition, subtraction, multiplication, division, exponentiation, and extraction of roots. In the 19th ...
, the expression ''1 + 2 × 3'' is well-formed, but the following expression is not:
:
.
Semantics
Semantics is the study of meaning. Formal semantics is about attaching meaning to expressions.
In
algebra, an expression may be used to designate a value, which might depend on values assigned to
variables occurring in the expression. The determination of this value depends on the
semantics attached to the symbols of the expression. The choice of semantics depends on the context of the expression. The same syntactic expression ''1 + 2 × 3'' can have different values (mathematically 7, but also 9), depending on the
order of operations
In mathematics and computer programming, the order of operations (or operator precedence) is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.
For exampl ...
implied by the context (See also
Operations § Calculators).
The semantic rules may declare that certain expressions do not designate any value (for instance when they involve division by 0); such expressions are said to have an undefined value, but they are well-formed expressions nonetheless. In general the meaning of expressions is not limited to designating values; for instance, an expression might designate a condition, or an
equation
In mathematics, an equation is a formula that expresses the equality of two expressions, by connecting them with the equals sign . The word ''equation'' and its cognates in other languages may have subtly different meanings; for example, in ...
that is to be solved, or it can be viewed as an object in its own right that can be manipulated according to certain rules. Certain expressions that designate a value simultaneously express a condition that is assumed to hold, for instance those involving the operator
to designate an internal
direct sum
The direct sum is an operation between structures in abstract algebra, a branch of mathematics. It is defined differently, but analogously, for different kinds of structures. To see how the direct sum is used in abstract algebra, consider a more ...
.
Formal languages and lambda calculus
Formal languages allow
formalizing the concept of well-formed expressions.
In the 1930s, a new type of expressions, called
lambda expressions, were introduced by
Alonzo Church and
Stephen Kleene for formalizing
functions and their evaluation. They form the basis for
lambda calculus
Lambda calculus (also written as ''λ''-calculus) is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It is a universal model of computation ...
, a
formal system used in
mathematical logic and the
theory of programming languages.
The equivalence of two lambda expressions is
undecidable. This is also the case for the expressions representing real numbers, which are built from the integers by using the arithmetical operations, the logarithm and the exponential (
Richardson's theorem).
Variables
Many mathematical expressions include
variables. Any variable can be classified as being either a
free variable or a
bound variable.
For a given combination of values for the free variables, an expression may be evaluated, although for some combinations of values of the free variables, the value of the expression may be undefined. Thus an expression represents a
function whose inputs are the values assigned to the free variables and whose output is the resulting value of the expression.
For example, the expression
:
evaluated for ''x'' = 10, ''y'' = 5, will give 2; but it is
undefined for ''y'' = 0.
The evaluation of an expression is dependent on the definition of the mathematical operators and on the system of values that is its context.
Two expressions are said to be equivalent if, for each combination of values for the free variables, they have the same output, i.e., they represent the same function. Example:
The expression
:
has
free variable ''x'', bound variable ''n'', constants 1, 2, and 3, two occurrences of an implicit multiplication operator, and a summation operator. The expression is equivalent to the simpler expression 12''x''. The value for ''x'' = 3 is 36.
See also
*
Algebraic closure
*
Algebraic expression
*
Analytic expression
*
Closed-form expression
*
Combinator
*
Computer algebra expression
*
Defined and undefined
*
Equation
In mathematics, an equation is a formula that expresses the equality of two expressions, by connecting them with the equals sign . The word ''equation'' and its cognates in other languages may have subtly different meanings; for example, in ...
*
Expression (programming)
*
Formal grammar
*
Formula
In science, a formula is a concise way of expressing information symbolically, as in a mathematical formula or a ''chemical formula''. The informal use of the term ''formula'' in science refers to the general construct of a relationship betwee ...
*
Functional programming
*
Logical expression
*
Term (logic)
In mathematical logic, a term denotes a mathematical object while a formula denotes a mathematical fact. In particular, terms appear as components of a formula. This is analogous to natural language, where a noun phrase refers to an object and a w ...
*
Well-defined expression
Notes
References
*
{{Mathematical logic
Abstract algebra
Logical expressions
Elementary algebra