Is there a notation that allows me to refer to the first/second element of an ordered pair? In programming, we define an "array" (basically an ordered n-tuple) in the following way:
$$a=[3,5].$$
Later on, if we want to refer to the first element of the predetermined array/pair/n-tuple, we write $a[0]$ (because in programming you start counting from $0$, not $1$), which will be equal to $3$.
Is there a similar notation for doing this in mathematics? E.g something like (3,5).firstElement, which would equal $3$? Or is such a reference only possible by using the set-theoretic definition of an ordered pair?
 A: A standard notation (used in Dieudonné, Foundations of Modern Analysis, page 12; Bourbaki, General Topology, Chapter 1, §4.1, page 44.) is $\operatorname{pr_i}(a_1,\cdots,a_n)=a_i$ since, given a set $A$, the map $$A^n\to A:(a_1,\cdots,a_n) \mapsto a_i$$ is called the $i$-th projection.
This notation has the merit that we have (almost) the same word in French (projection), German (Projektion), Dutch (projectie), Italian (proiezione), Spanish (proyección), etc...and all these words also start with  "pr".
A: If $X$ and $Y$ are sets, the function $f:X\times Y\to X$ given by $f(x,y)=x$ is called the projection from $X\times Y$ onto $X$; similarly, the function $g:X\times Y\to Y$ given by $g(x,y)=y$ is called the projection from $X\times Y$ onto $Y$. A variety of notations for projections are used, but, at least in the case $X=Y=\mathbb R$, it seems common to write $\pi^1$ for $f$ and $\pi^2$ for $g$ (see for instance Spivak's Calculus on Manifolds). Using this notation, we can write $\pi^1(3,5)=3$ and $\pi^2(3,5)=5$.
More generally, if $n$ is a positive integer, then the function $\pi^i:\mathbb R^n\to \mathbb R$ given by $\pi^i(x_1,\dots,x_n)=x_i$ is called the $i$th projection function. Although this is technically a different function for each value of $n$, in practice we gloss over this point.
A: It's common to assume that the elements of a tuple or vector named $a$ are indexed $a = \langle a_1, a_2, \dots \rangle$, so you would just refer to $a_1$ for the first element.
Similarly, the elements of a matrix $A$ are often assumed to be indexed as $a_{i,j}$.
