Coordinate ring of the unit circle is never a UFD? I'm reading some notes about coordinate rings. On the third example on the second page, the author notes that the coordinate ring $K[\mathcal{C}]$ is not a UFD. 
If $f=X^2+Y^2-1$, then in $K[\mathcal{C}]$, we have
$$
Y^2+(f)=(1-X)(1+X)+(f)
$$
but the elements $Y+(f)$, $1+X+(f)$ and $1-X+(f)$ are irreducible.

Is there a reason that it is clear that these three elements are irreducible? 

Writing $Y+(f)=g(X,Y)h(X,Y)+(f)$ and trying to verify one of $g+(f)$ or $h+(f)$ is a unit is getting a little hairy.
 A: At least $Y$ is not irreducible if there is some $i\in K$ such that $i^2=-1$. We have
$$K[\mathcal C]\cong K[\cos \theta,\sin \theta]\cong K[e^{ix},e^{-ix}]\cong K[t,t^{-1}]$$
via the maps
$$X\mapsto \cos\theta\mapsto \frac{e^{ix}+e^{-ix}}{2}\mapsto \frac{t+t^{-1}}{2}$$
$$Y\mapsto \sin\theta\mapsto \frac{-ie^{ix}+ie^{-ix}}{2}\mapsto \frac{-it+it^{-1}}{2}$$
Note that $Y\mapsto \frac12(-it+it^{-1})$ is irreducible iff $2i\cdot \frac12(-it+it^{-1})=t-t^{-1}$ is. But $t-t^{-1}=(1+t^{-1})(t-1)$, and neither of these are units since the units of $K[t,t^{-1}]$ are of the form $at^n$ with $a$ nonzero and $n\in\mathbb Z$. In $K[\mathcal C]$ this factorization looks like:
$$(X-iY+1)(X+iY-1)=2iY+(X^2+Y^2-1)$$
A: Remark that (under the assumption the characteristic of $K$ is not $2$), $\mathcal C$ is a smooth curve, and therefore $K[\mathcal C]$ is a Dedekind domain. Indeed, $\mathcal C$ is isomorphic, by stereographic projection ($X=\frac{1-T^2}{1+T^2}, Y=\frac{2T}{1+T^2}$), to $\mathbf P^1-\{\pm i\}$, which is an open subscheme of $\mathbf P^1$ and therefore smooth.
On a smooth curve, a section of the structure sheaf is determined, up to multiplication by a unit, by its divisor. It follows immediately that $1-X$ and $1+X$ are irreducible, since their divisors consist of a single point. 
On the other hand I claim that $Y$ is irreducible if and only if $i \notin K$. The divisor of $Y$ is $[A]+[B]$, where $A=(1,0)$, $B=(-1,0)$. The only way to write this divisor as a sum of two positive nontrivial divisors is as $[A]+[B]$. 
Thus, in order to see whether $Y$ is irreducible, we should look for a $W\in K[\mathcal C]$ with divisor precisely $[A]$ (i.e. a function which vanishes simply at $A$ and nowhere else on $\mathcal C$). Viewing $W$ as a rational function on $\mathbf P^1 = \overline{\mathcal C}$, it follows from the residue theorem that if $a_i, a_{-i}$ denote the orders of $W$ at $i$ and $-i$ then it should be the case that
$$a_i+ a_{-i}+1=0.$$ 
If $i\in K$, there is no obstruction to finding a $W$ which does the job, since every degree $0$ divisor on $\mathbf P^1$ is principal. By writing down the details one recovers Alex's factorization of $Y$.
On the other hand, if $i\notin K$ then $W$ is a rational function of the form $g(T)/(1+T^2)^n$, so $a_i=a_{-i}$ and therefore $a_i+ a_{-i}$ is even. It is then impossible to have $a_i+ a_{-i}+1=0$.
In fact, a little more work shows that $K[\mathcal C]$ is a PID if and only if $i \in K$. 
