The triangular numbers $T(n)$ are the numbers that count how many objects there are in "triangular arrays", arrays like $\bullet$, or $\begin{array}{ccc} &\bullet\\ \bullet&&\bullet \end{array}$ or $\begin{array}{cccccccc} &&\bullet\\ &\bullet &&\bullet\\ \bullet & &\bullet && \bullet\end{array}$.
The numbers are: $\begin{align*} T(1) &= 1\\ T(2) &= 1+2 = \frac{2\times 3}{2}\\ T(3) &= 1+2+3 = \frac{3\times 4}{2}\\ &\vdots\\ T(n) &= 1+2+\cdots+n = \frac{n(n+1)}{2}. \end{align*}$
Given a natural number $k$, there is a largest $m$ such that $T(m)\leq k$, and in that case we have that $k-T(m)\leq m$, since $T(m+1)=T(m)+m+1$.
Going down the diagonals counts triangular numbers. The first diagonal (the top corner) is $T(1)$. If you now add the second diagonal (the pairs $(1,2)$ and $(2,1)$) you get $T(2)$; add the third diagonal (consisting of pairs $(1,3)$, $(2,2)$, and $(3,1)$) you get $T(3)$. Etc.
So, given $k\in\mathbb{N}$, let $m$ be the largest integer such that $T(m)\leq k$. Then we are in the $k$th diagonal. If $r=k-T(m)$, then we've moved $k$ steps down and left. So we define $f(k) = \Bigl( r, T(m)-r\Bigr) = \Bigl( k-T(m), 2T(m)-k\Bigr),$ where $m$ is the largest integer with $T(m)\leq k$.