Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given a pair $(a, b) \in A \times B$, I would like to know how to write the functions which get the first element and the second element of the pair...

In a programming language, one can write $\textit{fst}: A \times B \rightarrow A$ and $\textit{fst} : (a,b) \mapsto a$. $\textit{snd}: A \times B \rightarrow B$ and $\textit{snd}:(a,b) \mapsto b$. Can we write same thing in mathematics?

share|cite|improve this question
sure these are well defined functions – Dominic Michaelis Feb 19 '13 at 23:58
Are you sure they are conventional in mathematics? – SoftTimur Feb 19 '13 at 23:59
up vote 5 down vote accepted

Yes, those are perfectly good functions. They are called projection functions and are often (but not always) written as $\pi_1$ and $\pi_2$.

Projection functions play an important role in the definition of the primitive recursive functions of computability theory. In this context, they are often written as $P^2_1$ and $P^2_2$, where the superscript indicates the total number of arguments, and the subscript shows which of the arguments is selected.

They are also an essential component of the category-theoretic definition of products; in category theory to prove that some object $X$ is a product $A\times B$ is precisely to give its projections $\pi_A:X\to A$ and $\pi_B:X\to B$ and show that they have certain characteristic properties.

share|cite|improve this answer

Generally people use $\pi$ because "projection" starts with a "p". You would want to specifically say in whatever proof you're writing that "$\pi_i$ is projection onto the $i^\text{th}$ component."

These are used quite heavily in mathematics.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.