# Expression (mathematics)

In

^{[1]}Other symbols include punctuation marks and brackets, used for grouping where there is not a well-defined order of operations

Expressions are commonly distinguished from

*formulas*: expressions are a kind of mathematical object, whereas formulas are statements

*about*mathematical objects.

^{[2]}This is analogous to natural language, where a noun phrase refers to an object, and a whole sentence refers to a fact

To *evaluate* or *simplify* an expression means to find a numerical value equivalent to the expression.^{[3]}^{[4]} Expressions can be *evaluated* or *simplified* by replacing operations that appear in them with their result. For example, the expression simplifies to , and evaluates to

An expression is often used to define a function, by taking the variables to be arguments, or inputs, of the function, and assigning the output to be the evaluation of the resulting expression.^{[5]} For example, and define the function that associates to each number its

*equivalent*if they define the same function. Such an equality is called a "semantic

A **formal expression** is a kind of string of symbols, created by the same production rules as standard expressions, however, they are used without regard to the meaning of the expression. In this way, two *formal expressions* are considered equal only if they are syntactically equal, that is, if they are the exact same expression.^{[6]}^{[7]} For instance, the formal expressions "2" and "1+1" are not equal.

## Variables and evaluation

In elementary algebra, a *variable* in an expression is a letter that represents a number whose value may change. To *evaluate an expression* with a variable means to find the value of the expression when the variable is assigned a given number. Expressions can be *evaluated* or *simplified* by replacing operations that appear in them with their result, or by combining like-terms.^{[8]}

For example, take the expression ; it can be evaluated at *x* = 3 in the following steps:

, (replace x with 3)

(use definition of exponent)

(simplify)

A *term* is a constant or the product of a constant and one or more variables. Some examples include The constant of the product is called the coefficient. Terms that are either constants or have the same variables raised to the same powers are called *like terms*. If there are like terms in an expression, you can simplify the expression by combining the like terms. We add the coefficients and keep the same variable.

Any variable can be classified as being either a

^{[9]}

For a non-formalized language, that is, in most mathematical texts outside of mathematical logic, for an individual expression it is not always possible to identify which variables are free and bound. For example, in , depending on the context, the variable can be free and bound, or vice-versa, but they cannot both be free. Determining which value is assumed to be free depends on context and semantics.^{[10]}

### Equivalence

An expression is often used to define a function, or denote compositions of funtions, by taking the variables to be arguments, or inputs, of the function, and assigning the output to be the evaluation of the resulting expression.^{[11]} For example, and define the function that associates to each number its

^{[12]}

^{[13]}The equivalence between two expressions is called an identity

For example, in the expression the variable *n* is bound, and the variable *x* is free. This expression is equivalent to the simpler expression 12 *x*; that is The value for *x* = 3 is 36, which can be denoted

### Polynomial evaluation

A polynomial consists of variables and

*k*-independent hashing

In the former case, polynomials are evaluated using floating-point arithmetic, which is not exact. Thus different schemes for the evaluation will, in general, give slightly different answers. In the latter case, the polynomials are usually evaluated in a finite field, in which case the answers are always exact.

For evaluating the

### Computation

A

^{[19]}

Despite the widespread uptake of this definition, there are some mathematical concepts that have no well-defined characterisation under this definition. This includes

^{[a]}

^{[20]}All statements characterised in modern programming languages are well-defined, including C++, Python, and Java.

^{[19]}

Common examples of computation are basic

of a number using mathematical models is a more complex algorithmic calculation.#### Rewriting

Expressions can be computed by means of an

*declarative languages*

*, such as Datalog, support multiple evaluation strategies. Some languages define a calling convention*

*.redexes), which one should be reduced (.
*

In

*contracted*) within a term. One of the most common systems involves lambda calculus

## Well-defined expressions

The

### Well-formed

The syntax of mathematical expressions can be described somewhat informally as follows: the allowed operators must have the correct number of inputs in the correct places (usually written with infix notation), the sub-expressions that make up these inputs must be well-formed themselves, have a clear order of operations, etc. Strings of symbols that conform to the rules of syntax are called *well-formed*, and those that are not well-formed are called, *ill-formed*, and are do not constitute mathematical expressions.^{[23]}

For example, in arithmetic, the expression *1 + 2 × 3* is well-formed, but

- .

is not.

However, being well-formed is not enough to be considered well-defined. For example in arithmetic, the expression is well-formed, but it is not well-defined. (See Division by zero). Such expressions are called undefined.

### Well-defined

Semantics is the study of meaning. Formal semantics is about attaching meaning to expressions. An expression that defines a unique value or meaning is said to be well-defined. Otherwise, the expression is said to be ill defined or ambiguous.** ^{[24]}** In general the meaning of expressions is not limited to designating values; for instance, an expression might designate a condition, or an equation 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.

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 implied by the context (See also Operations § Calculators).

For real numbers, the product is unambiguous because ; hence the notation is said to be *well defined*.^{}

Unlike with functions, notational ambiguities can be overcome by means of additional definitions (e.g., rules of

`-`

for subtraction is *left-to-right-associative*, which means that

`a-b-c`

is defined as `(a-b)-c`

, and the operator `=`

for assignment is *right-to-left-associative*, which means that

`a=b=c`

is defined as `a=(b=c)`

.^{[26]}In the programming language APL there is only one rule: from right to left

## Formal definition

The term 'expression' is part of the language of mathematics, that is to say, it is not defined *within* mathematics, but taken as a primitive part of the language. To attempt to define the term would not be doing mathematics, but rather, one would be engaging in a kind of metamathematics (the metalanguage of mathematics), usually mathematical logic. Within mathematical logic, mathematics is usually described as a kind of formal language, and a well-formed expression can be defined recursively as follows:^{[27]}

The alphabet consists of:

- A set of individual constants: Symbols representing fixed objects in the domain of discourse, such as numerals (1, 2.5, 1/7, ...), sets (, ...), truth values(T or F), etc.

- A set of individual variables: A countably infinite amount of symbols representing variables used for representing an unspecified object in the domain. (Usually letters like x, or y)

- A set of operations: unary operations)

- Brackets ( )

With this alphabet, the recursive rules for forming a well-formed expression (WFE) are as follows:

- Any constant or variable as defined are the atomic expressions, the simplest well-formed expressions (WFE's). For instance, the constant or the variable are syntactically correct expressions.

- Let be a n-ary operationover the domain, and let be metavariables for any WFE's.

- Then is also well-formed. For the most often used operations, more convenient notations (like infix notation) have been developed over the centuries.
- For instance, if the domain of discourse is the real numbers, can denote the binary operation +, then is well-formed. Or can be the unary operation so is well-formed.
- Brackets are initially around each non-atomic expression, but they can be deleted in cases where there is a defined order of operations, or where order doesn't matter (i.e. where operations are associative).

A well-formed expression can be thought as a syntax tree.^{[28]} The leaf nodes are always atomic expressions. Operations and have exactly two child nodes, while operations , and have exactly one. There are countably infinitely many WFE's, however, each WFE has a finite number of nodes.

### Lambda calculus

Formal languages allow formalizing the concept of well-formed expressions.

In the 1930s, a new type of expressions, called

^{[29]}

^{[b]}They form the basis for lambda calculus, 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).

## History

### Early written mathematics

Written mathematics began with numbers expressed as tally marks, with each tally representing a single unit. The numerical symbols consisted probably of strokes or notches cut in wood or stone, and intelligible alike to all nations. For example, one notch in a bone represented one animal, or person, or anything else. The Ishango bone, found near the headwaters of the Nile river (northeastern Congo), may be more than 20,000 years old and generally considered an early evidence of counting. The ordered engravings have led many to speculate the meaning behind these marks, including interpretations like mathematical significance or astrological relevance. Common interpretations are that the Ishango bone shows a six-month lunar calendar.^{[30]}

The

The

### Syncopated stage

The "*syncopated*" stage is where frequently used operations and quantities are represented by symbolic

^{}[38] The square of was ; the cube was ; the fourth power was ; and the fifth power was .

^{[39]}The main difference between Diophantine syncopated algebra and modern algebraic notation is that the former lacked special symbols for operations, relations, and exponents.

^{[40]}So for example, what would be written in modern notation as Would be written in Diophantus's syncopated notation as:

### Symbolic stage and early arithmetic

The transition to symbolic algebra, where only symbols are used, can first be seen in the work of

^{[44]}

The 14th century saw the development of new mathematical concepts to investigate a wide range of problems.^{}

^{[citation needed}

The

William Oughtred, introduced the multiplication sign (×). Johann Rahn introduced the division sign (÷, an obelus variant repurposed) .

## Types of expressions

### Algebraic expression

An *algebraic expression* is an expression built up from algebraic constants, variables, and the algebraic operations (addition, subtraction, multiplication, division and exponentiation by a rational number).^{[53]} For example, 3*x*^{2} − 2*xy* + *c* is an algebraic expression. Since taking the square root is the same as raising to the power 1/2, the following is also an algebraic expression:

See also: Algebraic equation and Algebraic closure

### Polynomial expression

A

Using

Many author do not distinguish polynomials and polynomial expressions. In this case the expression of a polynomial expression as a linear combination is called the *canonical form*, *normal form*, or *expanded form* of the polynomial.

### Computational expression

In

*evaluation*. In simple settings, the ).

In computer algebra, formulas are viewed as expressions that can be evaluated as a Boolean, depending on the values that are given to the variables occurring in the expressions. For example takes the value *false* if x is given a value less than 1, and the value *true* otherwise.

Expressions are often contrasted with statements—syntactic entities that have no value (an instruction).

Except for numbers and variables, every mathematical expression may be viewed as the symbol of an operator followed by a sequence of operands. In computer algebra software, the expressions are usually represented in this way. This representation is very flexible, and many things that seem not to be mathematical expressions at first glance, may be represented and manipulated as such. For example, an equation is an expression with "=" as an operator, a matrix may be represented as an expression with "matrix" as an operator and its rows as operands.

See: Computer algebra expression

### Logical expression

In mathematical logic, a *"logical expression"* can refer to either terms or formulas. A term denotes a mathematical object while a formula denotes a mathematical fact. In particular, terms appear as components of a formula.

A

## See also

## Notes

**^**The study of non-computable statements is the field of hypercomputation.**^**For a full history, see Cardone and Hindley's "History of Lambda-calculus and Combinatory Logic" (2006).

## References

**^**Oxford English Dictionary, s.v. “Expression (n.), sense II.7,” "*A group of symbols which together represent a numeric, algebraic, or other mathematical quantity or function.*"- ISBN 978-0-486-63829-4.
**^**Oxford English Dictionary, s.v. "Evaluate (v.), sense a", "*Mathematics. To work out the ‘value’ of (a quantitative expression); to find a numerical expression for (any quantitative fact or relation).*"**^**Oxford English Dictionary, s.v. “Simplify (v.), sense 4.a”, "*To express (an equation or other mathematical expression) in a form that is easier to understand, analyse, or work with, e.g. by collecting like terms or substituting variables.*"**(PDF) from the original on 2004-09-08. Retrieved 2020-04-29.****.****.****^**Marecek, Lynn; Mathis, Andrea Honeycutt (2020-05-06). "1.1 Use the Language of Algebra - Intermediate Algebra 2e | OpenStax".*openstax.org*. Retrieved 2024-10-14.- H. Jerome Keisler(1977).
*Model Theory*. Studies in Logic and the Foundation of Mathematics. Vol. 73. North Holland.; here: Sect.1.3 - ISBN 1402006098.
**(PDF) from the original on 2004-09-08. Retrieved 2020-04-29.****^**Equation. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=Equation&oldid=32613**^**Pratt, Vaughan, "Algebra", The Stanford Encyclopedia of Philosophy (Winter 2022 Edition), Edward N. Zalta & Uri Nodelman (eds.), URL: https://plato.stanford.edu/entries/algebra/#Laws**^**"Definition of COMPUTATION".*www.merriam-webster.com*. 2024-10-11. Retrieved 2024-10-12.- ISBN 978-0343895099.
**.****.****.**- ^ .
**.****. Retrieved 2021-08-21.****.****.****^**Weisstein, Eric W. "Well-Defined". From MathWorld – A Wolfram Web Resource. Retrieved 2013-01-02.**^**Weisstein, Eric W. "Well-Defined". From MathWorld – A Wolfram Web Resource. Retrieved 2013-01-02.**^**"Operator Precedence and Associativity in C".*GeeksforGeeks*. 2014-02-07. Retrieved 2019-10-18.- H. Jerome Keisler(1977).
*Model Theory*. Studies in Logic and the Foundation of Mathematics. Vol. 73. North Holland.; here: Sect.1.3 - ISSN 1431-4657.; here: Sect.II.1.3
**.****^**Marshack, Alexander (1991).*The Roots of Civilization*, Colonial Hill, Mount Kisco, NY.**^**Encyclopædia Americana. By Thomas Gamaliel Bradford. Pg 314**^**Mathematical Excursion, Enhanced Edition: Enhanced Webassign Edition By Richard N. Aufmann, Joanne Lockwood, Richard D. Nation, Daniel K. Cleg. Pg 186**^**"Mathematics in Egypt and Mesopotamia" (PDF). Archived from the original (PDF) on 2022-12-28. Retrieved 2013-07-25.- ISBN 0-471-54397-7). "Mesopotamia" p. 25.
**^**Mathematics and Measurement By Oswald Ashton Wentworth Dilk. Pg 14**^**Diophantine Equations. Submitted by: Aaron Zerhusen, Chris Rakes, & Shasta Meece. MA 330-002. Dr. Carl Eberhart. 16 February 1999.**^**Boyer (1991). "Revival and Decline of Greek Mathematics". pp. 180-182. "In this respect it can be compared with the great classics of the earlier Alexandrian Age; yet it has practically nothing in common with these or, in fact, with any traditional Greek mathematics. It represents essentially a new branch and makes use of a different approach. Being divorced from geometric methods, it resembles Babylonian algebra to a large extent. But whereas Babylonian mathematicians had been concerned primarily with*approximate*solutions of*determinate*equations as far as the third degree, the*Arithmetica*of Diophantus (such as we have it) is almost entirely devoted to the*exact*solution of equations, both*determinate*and*indeterminate*. [...] Throughout the six surviving books of*Arithmetica*there is a systematic use of abbreviations for powers of numbers and for relationships and operations. An unknown number is represented by a symbol resembling the Greek letter (perhaps for the last letter of arithmos). [...] It is instead a collection of some 150 problems, all worked out in terms of specific numerical examples, although perhaps generality of method was intended. There is no postulation development, nor is an effort made to find all possible solutions. In the case of quadratic equations with two positive roots, only the larger is give, and negative roots are not recognized. No clear-cut distinction is made between determinate and indeterminate problems, and even for the latter for which the number of solutions generally is unlimited, only a single answer is given. Diophantus solved problems involving several unknown numbers by skillfully expressing all unknown quantities, where possible, in terms of only one of them."**^**A History of Greek Mathematics: From Aristarchus to Diophantus. By Sir Thomas Little Heath. Pg 456**^**A History of Greek Mathematics: From Aristarchus to Diophantus. By Sir Thomas Little Heath. Pg 458**^**Boyer (1991). "Revival and Decline of Greek Mathematics". p. 178. "The chief difference between Diophantine syncopation and the modern algebraic notation is the lack of special symbols for operations and relations, as well as of the exponential notation."**^**O'Connor, John J.; Robertson, Edmund F., "al-Marrakushi ibn Al-Banna",*MacTutor History of Mathematics Archive*, University of St Andrews- ISBN 0-393-04002-X.
**). "Revival and Decline of Greek Mathematics" p. 178. (cf., "The chief difference between Diophantine syncopation and the modern algebraic notation is the lack of special symbols for operations and relations, as well as of the exponential notation.")****^**O'Connor, John J.; Robertson, Edmund F., "Abu'l Hasan ibn Ali al Qalasadi",*MacTutor History of Mathematics Archive*, University of St Andrews- ISBN 0-521-32260-X.
**^**Mathematical Magazine, Volume 1. Artemas Martin, 1887. Pg 124**^**Der Algorismus proportionum des Nicolaus Oresme: Zum ersten Male nach der Lesart der Handschrift R.40.2. der Königlichen Gymnasial-bibliothek zu Thorn. Nicole Oresme. S. Calvary & Company, 1868.**^**Clagett, Marshall (1961)*The Science of Mechanics in the Middle Ages*, (Madison: University of Wisconsin Press), pp. 332–45, 382–91.- Edmund M. Blunt(proprietor.), 1801.
**^**Miller, Jeff (2006-06-04). "Earliest Uses of Symbols of Operation".*Gulf High School*. Retrieved 2006-09-24.**^**Arithmetical Books from the Invention of Printing to the Present Time. By Augustus De Morgan. p 2.- Norimbergæ: Apud Iohan Petreium, 1544.
**^**Morris, Christopher G. (1992).*Academic Press dictionary of science and technology*. Gulf Professional Publishing. p. 74.algebraic expression over a field.

**^**Mitchell, J. (2002). Concepts in Programming Languages. Cambridge: Cambridge University Press,*3.4.1 Statements and Expressions*, p. 26**^**Maurizio Gabbrielli, Simone Martini (2010). Programming Languages - Principles and Paradigms. Springer London,*6.1 Expressions*, p. 120**^**Cassidy, Kevin G. (Dec 1985).*The Feasibility of Automatic Storage Reclamation with Concurrent Program Execution in a LISP Environment*(PDF) (Master's thesis). Naval Postgraduate School, Monterey/CA. p. 15. ADA165184.