TITLE: How to prove if a function is bijective?
QUESTION [28 upvotes]: I am having problems being able to formally demonstrate when a function is bijective (and therefore, surjective and injective). Here's an example:
How do I prove that $g(x)$ is bijective?
\begin{align}
f &: \mathbb R \to\mathbb R \\
g &: \mathbb R \to\mathbb R \\
g(x) &= 2f(x) + 3
\end{align}
However, I fear I don't really know how to do such. I realize that the above example implies a composition (which makes things slighty harder?). In any case, I don't understand how to prove such (be it a composition or not).
For injective, I believe I need to prove that different elements of the codomain have different preimages in the domain. Alright, but, well, how?
As for surjective, I think I have to prove that all the elements of the codomain have one, and only one preimage in the domain, right? I don't know how to prove that either!
EDIT
f is a bijection. Sorry I forgot to say that.

REPLY [4 votes]: First show that $g$ is injective ($1$-$1$) by showing that if $g(x)=g(y)$, then $x=y$. This isn’t hard: if $g(x)=g(y)$, then $2f(x)+3=2f(y)+3$, so by elementary algebra $f(x)=f(y)$. By hypothesis $f$ is a bijection and therefore injective, so $x=y$.
Now show that $g$ is surjective. To do this, you must show that for each $y\in\Bbb R$ there is some $x\in\Bbb R$ such that $g(x)=y$. That requires finding an $x\in\Bbb R$ such that $2f(x)+3=y$ or, equivalently, such that $f(x)=\frac{y-3}2$. But $f$ is known to be a bijection and hence a surjection, so you know that there is such an $x\in\Bbb R$.
In general this is one of the two natural ways to show that a function is bijective: show directly that it’s both injective and surjective. The other is to construct its inverse explicitly, thereby showing that it has an inverse and hence that it must be a bijection. You could take that approach to this problem as well:
$$g^{-1}(y)=f^{-1}\left(\frac{y-3}2\right)\;,$$
since 
$$\begin{align*}
g\left(f^{-1}\left(\frac{y-3}2\right)\right)&=2f\left(f^{-1}\left(\frac{y-3}2\right)\right)+3\\
&=2\left(\frac{y-3}2\right)+3\\
&=y\;,
\end{align*}$$
and since $f$ is a bijection, $f^{-1}\left(\frac{y-3}2\right)$ exists for every $y\in\Bbb R$.
Added: As Marc reminds me, this is only half the job: if you take this approach, you must either show directly that $g$ is injective, as I did above, or verify that the function that I called $g^{-1}$ above is a two-sided inverse, i.e., that $g^{-1}\big(g(x)\big)=x$ for $x\in\Bbb R$. This is not particularly difficult in this case:
$$\begin{align*}
g^{-1}\big(g(x)\big)&=g^{-1}\big(2f(x)+3\big)\\
&=f^{-1}\left(\frac{\big(2f(x)+3\big)-3}2\right)\\
&=f^{-1}\big(f(x)\big)\\
&=x\;,
\end{align*}$$
since $f$ is a bijection.