One-to-one correspondence between these two problems? 
How many 3-digit positive integers are there whose middle digit is
  equal to the sum of the first and last digits?

I noticed that the solution to this problem, $45$, is the same as the solution to the problem

How many 3-digit positive integers are there whose middle digit is the average
  of the first and last digits?

Is this purely a coincidence or is there some sort of a bijection/one-to-one correspondence that links these two?

Let $S=\{(a,b,c): b=a+c\}$ and $T=\{(a,b,c): b=\frac{a+c}{2}\}$, with $1\le a\le 9$ and $0\le b,c\le9$.
Define $f:S\rightarrow T$ by $ f(a,b,c)=\begin{cases} (\;\;\;a,\;\;\;\;\;\frac{b}{2},\;\;\;\;c) & \mbox{, if b is even}\\(10-a,\frac{19-b}{2},9-c) & \mbox{, if b is odd} \end{cases}$.
Then f defines a bijection between S and T, with inverse  $g:T\rightarrow S$ defined by
$\;\;\;\;\;\;\;\;g(a,b,c)=\begin{cases} (\;\;\;a,\;\;\;\;\;\;2b,\;\;\;\;\;\;\;c) & \mbox{, if $0\le b\le4$}\\(10-a,19-2b,9-c) & \mbox{, if $5\le b\le 9$} \end{cases}$. 
