I have given two modules $M$ and $N$ over a local ring $R$. I also know that $M \oplus N \cong R^n$ for some $n\in \mathbb{N}$. I then have to prove that both $M$ and $N$ are free modules.
Since $M \oplus N \cong R^n$ I know that $M \oplus N$ is free. If $M$ and $N$ are free it's easy to prove that $M \oplus N$ is free as well, however the opposite doesn't always hold. Therefore I have to do it some other way. I have tried constructing bases for the modules, but this was unsuccessful. Can anyone please help me?