Complement of a line in $\mathbb{A}^2$ as an algebraic variety I just started reading notes from an algebraic geometry course, and I'm curious about whether the complement of a line in $\mathbb{A}^2$ is always an algebraic variety. If so, what does it's coordinate ring look like. 
On a side note, does this in any way generalize to higher dimensions? I.e., what properties does the complement of a hyperplane have in $\mathbb{A}^n$?
 A: Yes, the complement of a line in $\Bbb{A}^2$ is an (open) affine subvariety of $\Bbb{A}^2$.
More generally, given an affine variety $V$ and a regular function $f \in \Gamma(V)$, the open subvariety $V_f \subset V$ given by the complement of the vanishing locus of $f$ inside of $V$, is an open affine subvariety of $V$ with coordinate ring given by
$$\Gamma(V_f)=k[x_1,...,x_n] \left[ \frac 1f \right]
$$
A proof of this fact may be found in Fulton's wonderful book on algebraic curves as Proposition 6.3.5.
On the other hand, as Serkan notes, $V_f$ cannot be a closed affine subvariety of $V$, as $V$ is irreducible. But $V_f$ is still an honest affine variety.

Edit: The following example might illustrate this. Let $L=Z(x) \subset \Bbb{A}^2$ be the line $x=0$. The claim is that the complement $\Bbb{A}^2_x=\{(u,v) \in \Bbb{A}^2 \vert u \neq 0\}$ of $L$ in $\Bbb{A}^2$ is an open affine subvariety of $\Bbb{A}^2$ with coordinate ring equal to $k[x,y][1/x]$.
To this end consider the closed subvariety $W=Z(xz-1) \subset \Bbb{A}^3$ and the map
\begin{split}
\varphi: \Bbb{A}_x^2 &\rightarrow W\\
(u,v) &\mapsto (u,v,1/u)
\end{split}
One can check that $\varphi$ is a morphism (i.e. it is continuous and takes regular functions on $\Bbb{A}^2_x$ to regular functions on $W$), whose inverse is induced by the projection map $\Bbb{A}^3 \rightarrow \Bbb{A}^2$ onto the first two factors. This means that
\begin{split}
\psi: W &\rightarrow \Bbb{A}^2_x\\
(u,v,w) &\mapsto (u,v)
\end{split}
is a morphism, which is inverse to $\varphi$, showing that $\Bbb{A}^2_x$ is indeed an affine variety (as it is isomorphic to a closed subvariety of some affine space).
Moreover it is straightforward to check that 
$$
\Gamma(\Bbb{A}^2_x) \cong \Gamma(W):=k[x,y,z]/(xz-1) \cong k[x,y][1/x]
$$
which shows the claim about the coordinate ring of $\Bbb{A}^2_x$.
