Can one write a PhD thesis before going into a PhD progam? Let's say I write a PhD thesis by looking at papers on arxiv. Can I use this as my PhD thesis one I enter into the program?
In other words, can you write a PhD thesis before going to graduate school?
Note. I took a year off and did intensive study. Given that, can I do it?
 A: Uh,you certainly can,but I've never heard of anyone,no matter how talented and precocious, doing such a thing. I HAVE heard of individuals who never formally entered a Master's or PHD program, were self taught and produced on their own a work of original research that was so significant, they were immediately awarded a doctorate on the spot and a research position. Karl Weirstruass famously did this, of course-as have several others. I believe there's a prestigious professorship chair at Harvard that's awarded once in a generation for pulling off such a feat. 
But I think you can count on your fingers the number of people who have successfully done this. The odds are definitely not with you.I know,I was once arrogant enough to think I could do it. Given my situation, part of me is still hoping I CAN-but I'm far more realistic about its probability of occurring, which converges very near to zero in the limit of the sequence of all my attempts prior to death. 
By all means,though-I wish you luck. 
A: No, you can't. There have been a few exceptional undergraduates that I've heard of who wrote papers that could pass as PhD theses somewhere, and they all went to grad school and wrote different (and better) theses as PhD students. Furthermore, your PhD thesis has to be based on work you did at graduate school, normally under the direction of an advisor. You can't get credit for research done elsewhere.
On a positive note, writing a good paper will help you get into graduate school, and will otherwise be beneficial to your development as a mathematician.
