Difficulty in Mathematical Writing Lots of people (including myself) face lot of problems in tackling Mathematical Problems, which appear as if we can solve it, but then writing out a solution becomes difficult.
Let us consider some examples:

*

*I was asked this question, some time back in an exam. Give an example of a continuous function on $(a,b)$ which is not uniformly continuous. Well, one's obvious choice is $$f(x) = \frac{1}{x-a} \quad \text{or} \ \frac{1}{x-b}$$ I knew this as soon as I saw the problem, and started proving it. One actually has to make an observation that as $x \to a$ then, $\frac{1}{x-a}$ will be larger. But I found that I couldn't actually formally prove it.


*Similarly, to prove that $f(x)=x^{2}$ is not uniformly continuous on $\mathbb{R}$, one again has to play with the quantifiers, to get the contradiction part.
So, these are two instances, where I have found the problem, which to me appeared that I could solve it, but writing out a formal solution became difficult.
How can students improve upon this? Are there any instances, which happened to you like this!
 A: What makes writing mathematics difficult is lack of confidence.  Someone confident who happens to be wrong will not face difficulties writing up their misapprehensions.
Willie's argument, getting familiar with lots of proof techniques that together solve most problems in some area, builds confidence: when you see such a problem, your reaction is "I know just what to do with you".  And if you've seen this technique applied to many different problems, you'll have a good understanding of the difficulties it faced.  
Even then, some problems will be tricky.  What happens when your favourite technique comes apart at the seams, and you say to yourself "I'm lost"?  My favourite trick is to look at whatever sublemma I'm trying to prove and to try to doubt it, and once I'm not quite sure it's true, to go looking for a counterexample.  This hopeless search often informs you of the contours of the proof you can then reattempt.  To put into slogan form: It's often hard to prove what you can't doubt.
Polya (1945)'s How to Solve It has many ideas about techniques to help you keep going when you run into difficulties proving things.
To sum up, being knowledgeable, as Willie suggests, is one key to being confident, and could call having the resources to deal with problem-solving setbacks being indefatigability, another key.  Self-help books are full of "you can do it!" advice that will help you write out what you think is a proof, but unfortunately, unlike the above, they reduce the chances that the proof is valid.
A: Just to complement the other nice answers, particularly Willie Wong's, I recommend you read and work through the book by Kevin Houston - "How to Think like a Mathematician: A Companion to Undergraduate Mathematics". It is a very nicely done title dealing with how to shape your intuition, your writing of math, different methods of proof, etc. I think anyone (being undergraduate or not) can benefit a lot from it. For example, I did my undergraduate degree in theoretical physics so reading this book helped me review fundamental concepts and get ready for the kind of thinking/writing style needed to shift to graduate mathematics.
A: I know this may be a little late, but I'm in the middle of an extremely good book, "How To Prove It - A Structured Approach".  I'm just starting a compSci degree and I've found the book very practically helpful in understanding what it takes to write a good proof and what strategies to use when approaching writing a proof.
A: You need practice in formulating your intuitions.  This is a skill that can be learned through practice, but like all skills, you can't begin just by jumping into the deep-end: you need to work consistently at extending your comfort zone, one small step at a time; over time you will then make substantial improvements.
What form should your practice take?  Well, you have to practice writing careful and complete proofs.   (The word "writing" here is important; it is not enough just to think about it and convince yourself that you could write a correct answer --- rather, sit down with pen and paper and carefully write out the full and correct answer.)
As a practical suggestion of where to begin (in light of your specific problem): rather than beginning directly with a concept like (failure of) uniform continuity, which involves a rather large number of quantifiers, be sure you can completely prove some simpler statements, such as "$1/(x-a)$ is unbounded on $(a,b)$" or "$x^2$ is unbounded on $\mathbb R$".   Once you can comfortably prove such statements, you can build up to carefully proving analytic statements with more quantifiers.
One more thing: When trying to prove statements (using precise definitions)
which you feel that you have a good intuitive understanding for, try to self-conciously reflect on how your intuition accords with the formal definitions.  For example, ask yourself "why do I think that $x^2$ is unbounded on $\mathbb R$?" Try to analyze your own intuition and extract some statement out of it.  Then compare this with the formal definition of unbounded and see if they are the same.  If so, great (!) ; you've got good intuition.  If they don't quite agree, try to understand why; what was missing in your intuition?  what extra aspect of the situation is the formal definition trying to capture?  Again, reflecting on and analyzing your mathematical intuition is a skill that can be practiced and which you can improve --- but, like all skills, you have to practice it if you want to get better.
A: I have a (joke) template file for writing papers, which contains in it

Lemma (Main technical lemma)
Let $D$ be a domain in (INSERT SPACE HERE) such that the following properties hold:

*

*Technical condition 1

*Technical condition 2

Then $D$ is both opened and closed in (INSERT SPACE AGAIN).


What is the point of the above? At some point in your mathematical career you will come to the realisation that the proofs you personally are going to write are all based on the few small set of technical arguments. For what I do the main tool happens to be the Method of Continuity. By the time you have this realisation, it will also be completely obvious to you how to formulate a given proof to fit the template.
But how to you come to this realisation? My only suggestion is to read more papers/books/proofs and write more of them yourselfs. Just like a foreign language, the only way to get better and converting your intuitive ideas into formal arguments is through practice and immersion.
As an aside, from the examples you gave, it is not quite clear whether your difficulty is with implementing $\epsilon$ - $\delta$ s, or with setting up the proof by contradiction.
Now, besides the usual proofs in textbooks, a good place to read up on proof techniques is Proofs from the BOOK by Aigner and Ziegler. Try to really figure out the details of each proof so you can explain the idea of it, a few days later, without having the book open. Another good resource for problem solving techniques is the Tricki. Of course, reading up on answers (and providing them) on this website would also help.

A bit on the quantifier issue. First you need to mentally nest the various implications. For example, diagrammatically I think (the following is not formal logic notation) uniform continuity to be something like
$$ \forall \epsilon \to \left( \exists \delta \to ( \forall |x-y| < \delta \to |f(x) - f(y)| < \epsilon ) \right) $$
So to contradict it by example, you want something that satisfies the hypothesis $\forall \epsilon$ for some $\epsilon_0$ but not the conclusion $\exists \delta \ldots$. Which means that for $\epsilon_0$ there cannot exist a $\delta$ with the requisite property. Which means that for such $\epsilon_0$ and for each $\delta$ the requisite property must be false. So after step 1 we have
$$ \exists \epsilon_0 \forall \delta \to \mbox{ not } ( \forall |x-y| < \delta \to |f(x) - f(y)| < \epsilon_0 ) $$
If the statement inside the parentheses were to be false, since it is a $\forall$ statement, you just need one example. So you can convert the negation to
$$ \exists \epsilon_0 \forall \delta \to \left( \exists |x-y| < \delta \mbox{ and } |f(x) - f(y)| > \epsilon_0 \right) $$
So there, we have converted a "negative statement" which we want to contradict, to a "positive statement" of a property we want our function to have.
A: The problem isn't really about writing. It's about being able to do math.
One of the big problems in math is the P = NP problem. Most mathematicians believe that the know that the two aren't equal.
There's however no accepted proof. As a result a lot of smart people work on the problem. Writing proofs is the main activity of professional mathematicians.
If you 'or'-sign instead of the 'and'-sign because you don't remember with is turned with way, then you have a problem with writing stuff down in a formal matter. 
If you however have no idea about what theorems you need to use to prove the solution then you misstate your problem by saying it's about writing stuff down in a formal matter.
Math centers around finding a way to prove your result. Faith isn't enough.
