How to overcome a mistake you make in your proof and regain motivation? I am an undergraduate student in computer science, and I have been working as an undergraduate researcher in theoretical computer science for 7 months. There was this problem that my supervisor mentioned, and I worked on it for a while. But I only managed to solve a sub-case of the problem, which didn't interest my supervisor at that time. However, he wanted me to write a manuscript about it anyway. I put a lot of effort into writing it, but he didn't bother to read it. And we have moved on to other things. 

A week ago, my supervisor called me, and he said that he found an interpretation of the sub-case of I've solved, that economists are interested in. And he said that we can publish it in a journal. So, I was really hyped. We met the next day, to review my proof. But when I arrived, I learned that a friend of my supervisor found an implicit assumption at the beginning of my proof which was clearly wrong. 

As you can imagine, I was devastated. I've tried to find a workaround, and fix my solution, but I've just found another thing that I've overlooked. So I've lost my enthusiasm and self-confidence.

However, my supervisor claims he found a completely different idea to solve the problem. He explained it to me, however it has some parts to be completed. So he wants me to write a manuscript about it and fill the gaps. However, I cannot find any motivation to do so. I am overwhelmed by the feelings of failure and anger.

I know that I should be working on my supervisor's idea, but I'm so distracted with the mistake I've made. How can I overcome my mistake, and start to work again?  

UPDATE: A month later, we solved the problem :)
As an early-career mathematician, I have had this experience, more or less exactly, several times. I think I've solved a problem (or made good progress toward doing so) and I become proud and emotionally invested, only to show it to a mentor (first my PhD advisor, then my postdoc supervisor) who quickly points out a fatal flaw in my reasoning. Sometimes, he will propose a different and much better method. I completely get how demotivating this can be. After all, I would think, why am I even working on this project if my mentor could do it himself more quickly?

But you have to overcome these feelings. Here are some points of view that helped me do so:


Trying things and failing is how we learn. There's a mathematical lesson here about why my techniques failed and my mentor's succeeded. There's also a lesson about how to do research: how to do sanity checks, how to avoid "premature optimization," etc.
My mentor is a professional researcher with decades of experience. Of course he can solve things more quickly than me. Even if it feels like my role is to work out the details of his ideas, I'm learning a lot by doing that. And these "brilliant ideas" are usually adapted from previously existing techniques anyway--it's more an experience gap than an intelligence gap.
Experiences like this keep me humble, which comes in very handy when teaching people who understand less than I do.


I would encourage you to try to power through these feelings of inadequacy. Part of being a mature researcher is not being afraid of being wrong. 

Having said all that, a good way to avoid situations like this is to keep the person you're working under more in the loop while you're doing the work, so that they can steer you away from dead ends. In your case, it wasn't necessarily your fault that your supervisor didn't devote much time to your project, but in the future you should try to get high-level feedback earlier in the process.