Ring of trigonometric functions with real coefficients Let $R$ be the ring of functions that are polynomials in $\cos t$ and $\sin t$ with real coefficients. 


*

*Prove that $R$ is isomorphic to $\mathbb R[x,y]/(x^2+y^2-1)$. 

*Prove that $R$ is not a unique factorization domain.

*Prove that $S=\mathbb C[x,y]/(x^2+y^2-1)$ is a principal ideal domain and hence a unique factorization domain. 

*Determine the units of the rings $S$ and $R$. (Hint: Show that $S$ is isomorphic to the Laurent polynomial ring $\mathbb C[u,u^{-1}]$.)
 A: Let me complete  YACP's excellent answer  by  describing the units of $S=\mathbb{C}[X,Y]/(X^2+Y^2-1)=\mathbb C[x,y]$.
We will use the isomorphism $\mathbb C[U,U^{-1}]\cong \mathbb C[x,y]:U\mapsto x+iy$
First note that the units of $\mathbb C[U,U^{-1}]$ constitute  the set $(\mathbb C[U,U^{-1}])^{\times}=\bigcup _{n\in \mathbb Z} \mathbb C^*U^n$ of non zero monomials.
Translating back to $S=\mathbb C[x,y]$ we obtain $$S^{\times}=\mathbb C[x,y]^{\times}=\bigcup _{n\in \mathbb Z} \mathbb C^*(x+iy)^n$$
[Don't forget that  $ ((x+iy)^n)^{-1}=(x-iy)^n$ since $(x+iy)(x-iy)=x^2+y^2=1$]
Edit: graded rings
It might be of some interest to put the problem in a  more general perspective.
In a $\mathbb Z$-graded domain  $R=\oplus_{n\in \mathbb Z} R_n$ it is immediate that units are homogeneous and from there it is obvious that  the units of $\mathbb C[U,U^{-1}]=\oplus_{n\in \mathbb Z} \mathbb CU^n$ are $(\mathbb C[U,U^{-1}])^{\times}=\bigcup _{n\in \mathbb Z} \mathbb C^*U^n$, as stated  above.
Similarly one would compute that the units of $\mathbb Z[U,U^{-1}]=\oplus_{n\in \mathbb Z} \mathbb ZU^n$ are given by $(\mathbb Z[U,U^{-1}])^{\times}=\bigcup _{n\in \mathbb Z} \mathbb \lbrace U^n,-U^n\rbrace  $.
However in a graded ring with zero divisors, units needn't be homogeneous : for example in  the ring of dual numbers $D=\mathbb C[X]/(X^2)=\mathbb C\oplus \mathbb C[\epsilon]$, the element $1+\epsilon$ is invertible (with inverse $1-\epsilon$) although it is not homogeneous.
A: (1) Send $X$ to $\cos$ and $Y$ to $\sin$. The kernel of this homomorphism consists from the polynomials $f\in\mathbb{R}[X,Y]$ with the property $f(\cos t,\sin t)=0$ for any $t\in\mathbb{R}$. Now prove that this implies $f$ divisible by $X^2+Y^2-1$: consider $f$ as a polynomial in $X$ with coefficients in $\mathbb{R}[Y]$ and write $f=(X^2+Y^2-1)g+r$, where $\deg_Xr\le 1$. Then $r=a+bX$, where $a,b\in\mathbb{R}[Y]$. From $f(\cos t,\sin t)=0$ for any $t\in\mathbb{R}$ we get that $r(\cos t,\sin t)=0$ for any $t\in\mathbb{R}$, that is, $a(\sin t)+b(\sin t)\cos t=0$ for any $t\in\mathbb{R}$. This gives us that $a^2(\sin t)=b^2(\sin t)(1-\sin^2t)$ for any $t\in\mathbb{R}$. But $a,b$ are polynomials and the last relation implies that $a^2(Y)=b^2(Y)(1-Y^2)$ and this is enough to deduce $a=b=0$ (why?).
(2) We show that $x$, the residue class of $X$ in $\mathbb{R}[X,Y]/(X^2+Y^2-1)$ is irreducible and does not divide $1+y$ and $1-y$, the residue classes of $1+Y$ and $1-Y$. (Note that in $\mathbb{R}[x,y]$ we have $x^2=(1+y)(1-y)$.)
Edit. If $x=z_1z_2$, then, by using (4) (see below) we get $N(x)=N(z_1)N(z_2)$ $\Leftrightarrow$ $Y^2-1=N(z_1)N(z_2)$. Now we have the following cases:
(i) $\deg N(z_1)=0\Leftrightarrow z_1\in\mathbb R^*$,
(ii) $\deg N(z_1)=2$ $\Leftrightarrow$ $\deg N(z_2)=0$ $\Leftrightarrow$ $z_2\in\mathbb R^*$,
(iii) $\deg N(z_1)=\deg N(z_2)=1$. If $N(z_1)=Y-1$, then $a_1^2(Y)+b_1^2(Y)(Y^2-1)=Y-1\Rightarrow Y-1\mid a_1(Y)\Rightarrow\exists a_2\in\mathbb R[Y]$ such that $a_1=(Y-1)a_2$ and pluggin this in the foregoing equation we get $a_2^2(Y)(Y-1)+b_1^2(Y)(Y+1)=1$. Looking now at the leading coefficients of $a_2$ and $b_1$ we find that one of these is zero (false!) or the sum of their square is zero (false!).
Assume that $x\mid 1-y$. Then $N(x)\mid N(1-y)\Leftrightarrow Y^2-1\mid (Y-1)^2$, a contradiction.
(3) I've proved here all you need for this part.
(4) As one can see from $(1)$ the elements of $\mathbb{R}[x,y]$ can be uniquely written as $a(y)+b(y)x$. Define a "norm" $N:\mathbb{R}[x,y]\to\mathbb{R}[Y]$ by $N(a(y)+b(y)x)=a^2(Y)+b^2(Y)(Y^2-1)$. $N$ is multiplicative and using this we get that the units of $\mathbb{R}[x,y]$ are the non-zero elements of $\mathbb{R}$.
For $\mathbb{C}[x,y]$ we can see, via the isomorphism from part $(3)$ that the invertible elements are the non-zero elements of $\mathbb{C}$, the powers of $x+iy$ and $x-iy$, and products of the non-zero elements of $\mathbb{C}$ with the powers of $x+iy$ and $x-iy$.
A: There is another way to think about this problem.  Since $R:= \mathbb R[x,y]/(x^2 +y^2 -1 )$ is a smooth affine curve, it is a normal ring (i.e. integrally closed in its fraction field), and so it is factorial if and only if it has trivial class group.
Here and below I will use ideas discussed in Hartshorne, Ch.II.6, in the subsection on Weil divisors.
We may consider $U :=$ Spec $R$ as an affine open curve, and then consider its projective closure $X$.  The curve $X$ is a plane conic, and so its class group (equivalently, its Picard group) is isomorphic to $\mathbb Z$, generated by the class of any rational point (e.g. the class of the point $(1,0)$).  
Now $Z := X \setminus U$ is irreducible (it is a single point of $X$, which geometrically becomes two points, namely the two points at infinity $[1:\pm i: 0]$ --- note that neither of these points is individually defined over $\mathbb R$, but their union is, and so it corresponds to a single point on $X$ with residue field equal to $\mathbb C$); this is where we use that our curve is defined over $\mathbb R$ rather than $\mathbb C$.  (In the latter case $Z$ is not irreducible, but is the union of the preceding two points, which are now both defined over $\mathbb C$.) 
We now use the exact sequence of Hartshorne II.6, Prop. 6.5, namely
$$\mathbb Z \to \mathrm{Cl}(X) \to \mathrm{Cl}(U) \mapsto 0,$$
where the first arrow is defined by $n \mapsto $ the class of $nZ$.
Recalling that Cl$(X) = \mathbb Z$, and that
$Z$ corresponds to a pair of points over $\mathbb C$, this 
 exact sequence can be written more explicitly as
$$\mathbb Z \to \mathbb Z \to \mathrm{Cl}(U) \to 0,$$
where the first map is multiplication by $2$.
Thus Cl$(R) = $ Cl$(U) = \mathbb Z/2$, and we see that $R$ is not a UFD.
Explicitly, we see that a maximal ideal in $R$ will be principal precisely
if its residue field is equal to $\mathbb C$ (rather than $\mathbb R$).
Thus e.g. the maximal ideal $(x,y-1)$, which cuts out the point $(0,1)$ and
has residue field $\mathbb R$, is not principal.

One can think about this more geometrically:
If the maximal ideal cutting out a point $P$ over $\mathbb R$ is principal,
then it is generated by some real polynomial $f(x,y)$.  But then the ideal $(f)$ in $R$ is a product of maximal ideals corresponding to the intersection of the curve $f = 0$ with the curve $U$.  By assumption this is just the single point $P$, with multiplicity one, and so (now passing from the affine picture to the projective picture) all the other intersections must be with the two points in $Z$.   By Bezout, the total number of intersections of $f = 0$ with $X$ is even, and we are assuming the intersection of $f = 0$ with $U$ consists of the single point $P$, so in fact the number of intersections with $Z$ must be odd.  But this set of intersections (counted with multiplicity) is symmetric under complex conjugation (since $f$ has real coefficients) and so it must be even (because the two points of $Z$ are interchanged by complex conjugation).  This contradiction shows that the maximal ideal of $P$ is not principal. (This is more or less a rewriting of the proof of Hartshorne's Prop. 6.5 in this
particular case.)

It is also easy to see what happens when we extend scalars  from $\mathbb R$ to $\mathbb C$, i.e. pass from $R$ to $S$.  The set $Z$ now becomes the union of two points, and so for any point $P$ of $U$ (now over $\mathbb C$) we can find a generator of the maximal ideal by choosing $f$ to be the equation of a line passing through $P$ and one of the two points in $Z$.  E.g. for $P = (0,1)$, we can take a generator of the ideal $(x,y-1)$ to be $(y - 1 \pm ix)$.  (Either choice of sign will do; their ratio is a unit in $S$.)  
In terms of the exact sequence of class groups, $Z$ is no longer irreducible,
but the union of two points each of degree one, and so the exact sequence becomes
$$\mathbb Z \oplus \mathbb Z \to \mathrm{Cl}(X_{/\mathbb C}) \to
\mathrm{Cl}(U_{/\mathbb C}) \to 0,$$
which more explicitly is $$\mathbb Z \oplus \mathbb Z \to \mathbb Z \to \mathrm{Cl}(U_{/\mathbb C}) \to 0,$$
with the first map being given just by $(m,n) \mapsto m+n$.
Evidently this map is surjective, and so
Cl$(S) =$ Cl$(U_{/\mathbb C}) = 0.$
