OK, so I am heading for a Ph.D. program in math. I have recently been thinking about the process of doing research. As an undergrad you're mostly given toy problems where the solution is not too far away and the right plan of attack can usually be seen in just a few minutes or seconds by just staring at the problem. This has been pretty much the case for all my courses, including the graduate courses I took. Now when doing real research this most probably doesn't work or at least I would assume that it's inefficient. After having thought about the work I did on my senior thesis, I realized I probably ended up trying the same approaches that didn't work time and time again until I miraculously came up with an idea that worked. What I'm basically asking is do you or how do you document your work on a problem? Do you document all the different ideas you've had and how you have tried to apply them? How do you prevent yourself from wasting time by doing the same thing again and again? I would assume that documenting ideas and failures also spawns other interesting problems, so it would be something of importance.