When I am doing a homework problem or self-studying, I can usually do proofs that only require theorems or definitions. But lately I've been trying to read more advanced texts in analysis and algebra on my own and its clear to me that I cannot solve problems just by using the definitions or theorems. For example:
Let $E'$ be the set of all limit points of a set $E$. Prove that $E'$ is closed.
In fact after spending weeks on this problem, I decided to look up the solution. Although I understand the solution, I don't think I could have ever come up with such a solution to the problem.
Is struggling like this for weeks the best way to solve more difficult problems? If not, what should I do differently?