Is there a simple bijection between $\mathbb{R}^2$ and lines on a plane? The two sets have the same cardinality as $\mathbb{R}$, so there is a bijection, but I can't come up with a simple function or prove that one does not exist.
 A: I will do this by using first a bijection from lines in the plane to lines in the plane that do not go through the origin (this is very similar to the standard bijection $[0,1]\to (0,1]$, if you're familiar with that). Then a bijection from lines that do not contain the origin to the plane with the origin taken away. Finally, a bijection from $\Bbb R^2\setminus\{0\}$ to the plane.
For each line through the origin, find its normal vector in the direction most upwards (the direction with positive $y$-coordinate) (for the $y$-axis, use the vector $(1,0)$). Then take each of those lines and move them one unit in that normal direction. Then take any line it landed on, and move that one unit in the same direction, and so on.
In other words, if you prescribe to each line in the plane a normal vector in this manner, then each line whose distance to the origin is an integer, and where the origin lies on the opposite side from the normal vector, is to be moved one unit in the direction of its normal vector. This gives a bijection between the lines in the plane and the lines in the plane that do not go through the origin.
Now, for each line in the plane that doesn't go through the origin, it has a unique representation on the form $ax+by = 1$ where $a$ and $b$ are not both zero, and for each such pair $a, b$, we get a unique line. Let each line correspond to the point $(a, b)\in \Bbb R^2$, and we have a bijection between lines that do not go through the origin to the plane without the origin.
Finally, a bijection between $\Bbb R^2\setminus\{0\}$ and $\Bbb R^2$, I think you can find yourself.
A: There a number of readily constructible "near bijections" that take some elements to infinite elements.
e.g.
$$
(u,v) \leftrightarrow u \cdot x + v \cdot y = k \neq 0
$$
misses lines through the (x,y) origin ($k=0$ would only hit lines through the origin), while
$$ 
(u, v) \leftrightarrow y = u \cdot x + v$$
misses vertical lines.
We want to fix this up, but it's not quite trivial.  The basic problem is that the natural geometry of lines on the plane is that of the projective-plane, or alternatively the sphere with opposite points identified.  In the first case, the (u,v) pair of (0,0) maps to the "line at infinity" (which we wish to exclude), and lines through the origin are various ways to approach the point at infinity.   It'd be nicer to have limits so that when our (u,v) coordinates tend to infinity the mapped line tend to the line at infinity. 
We can alter the first mappings so the excluded lines for infinite (u,v) are elsewhere -- finite (u,v), but making the $k$ value zero at a finite distance.
Taking the "half a sphere" notion seriously, consider the top half of the unit sphere:
$$z = \sqrt{1 - x^2 - y^2}.$$
We can now map the point (x,y,z) on this surface to a line on the plane (u,v) with
$$u \cdot x + v \cdot y = z.$$ The points on the equator are lines through the origin, and the north pole is the line at infinity.  The task now is to map the plane into this half sphere, and make sure that infinity ends up at the top.
Can we do this mapping?  Yes. 
Stereographic projection and the Riemann sphere to the rescue: to each such point we can associate a point on the unit sphere:
$$
(x,y,z) = \left(\frac{2u}{u^2+v^2+1},\frac{2v}{u^2+v^2+1},\frac{u^2+v^2-1}{u^2+v^2+1}\right)
$$
The reverse mapping is just $(u,v) =  (x/(1-z), y/(1-z))$.
If we treat u and v as the real and imaginary parts of a single complex coordinate, infinity is at the top (0,0,1), zero at the bottom (0,0,-1), 1 on the right (1,0,0), i at the back (0,1,0).  This is the Riemann sphere picture of the projective complex line. We only want half of the sphere though, so we take the square root.  This maps no two inputs to the same output, and leaves us with $u \geq 0$: the "right half" of  the sphere as commonly visualized. This also leaves 0, 1, and infinity invariant, but we want infinity at the top of the dome. To fix this up, we sandwich this square root operation with Moebius transforms that rotate the sphere.  The one after the square root must rotate the center of the half-dome (at z = 1) to infinity, the north pole.  The other, before the transform has to rotate the the north pole down to 1.
Explicitly, the following Moebius transforms do that:
$$
f(z) = \frac{z-1}{z+1}
$$
and its inverse
$$
f^{-1}(z) = \frac{z+1}{-z+1}
$$
These are both rigid rotations of the Riemann sphere.
Putting this all together, we map $\mathbb{R}^2$ viewed as $\mathbb{C}$ (let $w = u+iv$) to $\mathbb{R}^2 - D$ with $f^{-1}(\sqrt{f(w)})$. Stereographically projecting gets us the top half of the unit sphere, and those (x,y,z) coordinates can be then used to create the equation for a line.  The only point we can't construct a line from is the north pole, which is infinity, and thus was never in the plane.
The reverse transform is straightforward.
Some notes: opposite points on the equator result in the same line, but we only have half the equator, due to the square root operation, so this is fine.  Ideally, we would have opposite points on the equator map to the same coordinates in $\mathbb{R}^2$, but this is impossible, due to topological considerations.  See e.g. https://mathoverflow.net/questions/50932/continuous-bijective-way-of-representing-a-line-on-a-plane, however the mapping constructed here is continuous except across this cut.  Instead going across this cut with the same real part is continuous.
I have switched haphazardly between x,y, and z; and u,v and w.  I hope it's clear what is what.
