Bijection/Examples/-1^x of Floor of Half x from Natural Numbers to Integers

From ProofWiki
Jump to navigation Jump to search

Example of Bijection

Let $f: \N \to \Z$ be the mapping defined from the natural numbers to the integers as:

$\forall x \in \N: f \paren x = \paren {-1}^x \floor {\dfrac x 2}$

Then $f$ is a bijection.


Proof

Let $x_1, x_2 \in \N$.

Suppose $f \paren {x_1} = f \paren {x_2}$.

Then, for a start:

$\paren {-1}^{x_1} = \paren {-1}^{x_2}$

and so $x_1$ and $x_2$ are either both even or both odd.


Suppose $x_1$ and $x_2$ are both even.

Then:

\(\displaystyle f \paren {x_1}\) \(=\) \(\displaystyle f \paren {x_2}\)
\(\displaystyle f \paren {2 m}\) \(=\) \(\displaystyle f \paren {2 n}\) for some $m, n \in \N$
\(\displaystyle \leadsto \ \ \) \(\displaystyle \paren {-1}^{2 m} \floor {\dfrac {2 m} 2}\) \(=\) \(\displaystyle \paren {-1}^{2 n} \floor {\dfrac {2 n} 2}\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle \floor m\) \(=\) \(\displaystyle \floor n\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle m\) \(=\) \(\displaystyle n\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle 2 m\) \(=\) \(\displaystyle 2 n\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle x_1\) \(=\) \(\displaystyle x_2\)


Suppose $x_1$ and $x_2$ are both odd.

Then:

\(\displaystyle f \paren {x_1}\) \(=\) \(\displaystyle f \paren {x_2}\)
\(\displaystyle f \paren {2 m + 1}\) \(=\) \(\displaystyle f \paren {2 n + 1}\) for some $m, n \in \N$
\(\displaystyle \leadsto \ \ \) \(\displaystyle \paren {-1}^{2 m + 1} \floor {\dfrac {2 m + 1} 2}\) \(=\) \(\displaystyle \paren {-1}^{2 n + 1} \floor {\dfrac {2 n + 1} 2}\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle -1 \floor {m + \dfrac 1 2}\) \(=\) \(\displaystyle -1 \floor {n + \dfrac 1 2}\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle m\) \(=\) \(\displaystyle n\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle 2 m + 1\) \(=\) \(\displaystyle 2 n + 1\)
\(\displaystyle \leadsto \ \ \) \(\displaystyle x_1\) \(=\) \(\displaystyle x_2\)


Thus:

$\forall x_1, x_2 \in \N: f \paren {x_1} = f \paren {x_2} \implies x_1 = x_2$

and so $f$ is an injection by definition.

$\Box$


Let $y \in \Z$ such that $y \ge 0$.

Consider the natural number $x = 2 y$.

Then:

\(\displaystyle f \paren x\) \(=\) \(\displaystyle \paren {-1}^{2 y} \floor {\dfrac {2 y} 2}\) Definition of $f$
\(\displaystyle \) \(=\) \(\displaystyle \floor y\)
\(\displaystyle \) \(=\) \(\displaystyle y\)

Thus:

$\forall y \in \Z_{\ge 0}: \exists x \in \N: f \paren x = y$


Let $y \in \Z$ such that $y < 0$.

Consider the natural number $x = 2 \paren {-y} + 1$.

Then:

\(\displaystyle f \paren x\) \(=\) \(\displaystyle \paren {-1}^{2 \paren {-y} + 1} \floor {\dfrac {2 \paren {-y} + 1} 2}\) Definition of $f$
\(\displaystyle \) \(=\) \(\displaystyle -\floor {\paren {-y} + \dfrac 1 2}\)
\(\displaystyle \) \(=\) \(\displaystyle y\)

Thus:

$\forall y \in \Z_{<0}: \exists x \in \N: f \paren x = y$


Thus by definition $f$ is a surjection by definition.

$\Box$


Thus $f$ is both an injection and a surjection, and so by definition a bijection.

$\blacksquare$


Sources