Citing in undergraduate thesis
How do I cite or refer to the sources I am using?


Different institutions/publishers prefer different citation styles, there is a whole range to choose from. Popular ones include IEEE, MLA, Chicago, Elsevier, etc. You ought to refer your thesis writing guidelines as mentioned by your institution or ask your advisor for further clarifications on this one.


  In which places is it appropriate?


If you understand why citing is important, you would know that you ought to cite every source you refer. Especially considering that your academic thesis is work you claim as your own, you ought to differentiate between what comes from you and what comes from others.


  If I include a theorem from some source, internalize the proof strategy and then formulate a proof without peeking at the source, should I mention the source of the theorem?


Yes, you should. The theorem proof may be yours but the theorem itself isn't. As @JeffE suggested, cite the original source of the theorem, if you could find it. Otherwise, search for another secondary, yet credible and accessible, source of information that would point to your theorem.