So, I'm a biologist at KCL, but I quite like mathematics and so am going through a book of exercises in algebra. Unfortunately, I've run into a problem in trying to answer some of the questions. I've been told that here might be a nice place to ask and so I was wondering if anyone would be able to help me (my mathematician friends also tend to be strict about notation, so apologies if it's not right). The questions lead you to showing if you have a principal ideal domain and a finitely generated module over it, then that module must be the distinct sum of a free module and its torsion. I can get to this point. However, it then asks if this free module is unique and why this may be false if it's not over a principal ideal domain. Here is where I get stuck.
Attempt at solution: I don't fully understand what it means by unique. I tried to generate some modules to see if I could see what was happening, but I think I'm falling down at understanding how to use the torsion. I tried things like the integers, but ended up with no torsion for any module I could think of. I the tried things like Z modulo nZ, but couldn't think of modules over them. Naturally, I looked online and I think this is known as the Structure Theorem For PIDs, hence the title, but couldn't find any concrete examples. I've also read that the ideal (x,2) over the integer polynomial ring provides a counter example, i.e. the second part, but I can't see how.
Let's focus on the example you gave: view the ideal $I=(x,2)$ inside of the ring $R=\Bbb Z [x]$ as an R module.
Obviously it has no torsion because it's in a domain. That being the case, the entire module would have to be free, in order to fit the decomposition description. We will see this is not possible, so that we have an example of a finitely generated module over a domain which doesn't decompose nicely.
Lets now suppose that it is a free module. (Checking uniqueness of the module or it's rank is premature because we don't even know if it's free yet.)
If $I$ were a direct sum of more than one copy of $R$, then $I$ would contain two nonzero ideals of $R$ that have intersection zero. But this is not possible in a domain! On the other hand, if $I$ were isomorphic to $R$, it would be a cyclic module: but this is also false! Thus $I$ does not decompose into a torsion and free part.