The short answer
In math, λ (lambda) is the eleventh letter of the Greek alphabet. Its meaning depends on context. Mathematicians and scientists often use it as the name of a parameter or constant, such as an eigenvalue, a wavelength or a rate. In lambda calculus, a formal system for describing functions, λ marks an anonymous function. That is where the programming term “lambda function” comes from.
λ as a symbol in math
λ is a general-purpose symbol, so its meaning changes from one field to another. Some common uses:
- Eigenvalues. In linear algebra, a number λ is an eigenvalue of a matrix A when Av = λv for some nonzero vector v.
- Wavelength. In physics, λ is often used for wavelength.
- Rate. In probability, λ is often the average rate in a Poisson distribution.
- Multipliers. In optimization, λ is often used for a Lagrange multiplier attached to a constraint.
- Decay. In some physics formulas, λ stands for a decay constant.
Other letters are used for these quantities in some texts, so check the notation in the source you are reading.
Lambda calculus
Lambda calculus is a formal system for describing functions. Alonzo Church developed it in the 1930s. It writes a function as λ, followed by the input name, a dot and an expression. For example, λx. x + 1 is the function that adds 1 to its input. Applying it to 4 gives 5.
Lambda calculus is one of the standard models of computation, and it helped shape how programming languages handle functions.
Where the programming term comes from
The Lisp programming language, from the late 1950s, used the word lambda for anonymous functions, and many later languages kept that idea. Python has a lambda keyword. C++ added lambda expressions in C++11. The same add-one function looks like this in each:
add_one = lambda x: x + 1
#include <iostream>
int main() {
auto add_one = [](int x) { return x + 1; };
std::cout << add_one(4) << "\n"; // 5
}
The math notation λx. x + 1 and the C++ code describe the same function: take an input x and return x + 1. The keyword or brackets differ from one language to another.
Does the math meaning matter for coding?
Usually not. Once you know that a lambda function is an unnamed function written inline, the practical question is What’s the point of lambda functions? The short answer is that they let you write a small function right where it is used, which keeps short logic close to the code that needs it.
Quick summary
- In math, λ is a Greek letter with many uses, often for a parameter or a constant.
- In lambda calculus, λ introduces an anonymous function.
- Programming lambda functions take their name from that idea, but each language writes them with its own syntax.