Examples of mathematical discoveries which were kept as a secret There could be several personal, social, philosophical and even political reasons to keep a mathematical discovery as a secret. 
For example it is completely expected that if some mathematician find a proof of $P=NP$, he is not allowed by the government to publish it as same as a usual theorem in a well-known public journal because of high importance and possible uses of this special proof in breaking security codes which gives an undeniable upper hand to the state intelligence services with respect to other countries. Also by some social reasons publishing such a proof publicly is not suitable because many hackers and companies may use it to access confidential information which could make a total chaos in the community and economy. 
The example shows that in principle it is possible to have some very significant brilliant mathematical proofs by some genius mathematicians which we are not even aware of. But in some cases these "secrets" unfold by an accident or just because they lost their importance when some time passed and the situation changed.

Question: What are examples of mathematical discoveries which were kept as a secret when they discovered and then became unfolded after a while by any reasons?

 A: William Sealy Gosset, while working at Guinness, developed a way of gauging the quality of raw materials with very few samples ($\implies$ less lab work $\implies$ cheaper!). As the story goes, company policy at Guinness forbade its chemists from publishing their findings. Thus Gosset had to publish under the pseudonym "Student".
The results of his work are known as Student's t-test and Student's distribution.
A: An example is Pythagorians discovery of irrationality of $\sqrt{2}$. They kept it as a secret for a while because of their special philosophical point of view about the rationality of all numbers in the world. In fact their cosmology were based on a presumption that everything in the nature is made of numbers and their ratios. Some stories say that finally a student of Pythagoras' academy left the society and revealed this secret to public. 
Read more on their philosophical point of view here, and the controversy over irrational numbers here. Also you can find additional information on the history of unfolding the secret of irrationality of $\sqrt{2}$ in many texts in history of philosophy and mathematics including Russell's "A History of Western Philosophy". 
A: Ed Thorp is thought to have discovered the Black-Scholes formula a few months/years prior to Black and Scholes.
Instead of sharing it, he created one of the world's first quantitative hedge fund and used the formula to (quickly said) trade options better than the rest of the market. Some references : 


*

*http://business.time.com/2007/02/05/ed_thorp_explains_the_new_hedg/

*http://www.wilmott.com/pdfs/030813_thorp.pdf
The same guy had also developed a theory of counting cards in Blackjack, using it in numerous casinos, before publishing it in his best-selling book, Beat the dealer.
A: Actually, I think the best example is of a mathematician who is alive nowadays and proved many results which were unpublished for many years just because he wanted to present them all together in order to solve a famous problem: Fermat's last theorem.
His name is Andrew Wiles.
A: Cryptography is often a good source of such instances:

At GCHQ, Cocks was told about James H. Ellis' "non-secret encryption" and further that since it had been suggested in the late 1960s, no one had been able to find a way to actually implement the concept. Cocks was intrigued, and developed, in 1973, what has become known as the RSA encryption algorithm, realising Ellis' idea. GCHQ appears not to have been able to find a way to use the idea, and in any case, treated it as classified information, so that when it was rediscovered and published by Rivest, Shamir, and Adleman in 1977, Cocks' prior achievement remained unknown until 1997. Source: Wikipedia

A: A lot of interesting answers above!  I would add that a lot of the work done at Betchley Park during W.W. II as well as the work done by Oppenheimer's group at Los Alamos was of course kept secret until the war was over -- and even long after that!
A: Johann Bernoulli challenged the other mathematicians of his time to solve the Brachistochrone problem, even though he knew the solution already.
This of course gave rise to the Calculus of Variations.
A: 
6accdae13eff7i3l9n4o4qrr4s8t12ux

Added later:  I posted the "aenrsw" above in cryptic form as a bit of secretive levity, but in case the link gets broken, the character string is an anagram used by Newton in a 1677 letter to Leibniz to lay claim to the fundamental theorem of calculus without revealing it.
A second, famous example, from an 1829 letter from Gauss to Bessel alluding to the discovery of non-euclidean geometry:

"[I]t will likely be quite a while before I get around to preparing my
  very extensive investigations on this for publication; perhaps this
  will never happen in my lifetime since I fear the cry of the Boetians
  if I were to voice my views."

A: The writing of Stephen Wolfram's book A New Kind of Science involved Wolfram Research employees. Wolfram considers proofs done by these employees to be covered by their NDAs, which is exemplified by Matthew Cook's proof that the cellular automata Rule 110 is Turing complete. That proof was first written in 1994, but Matthew Cook was dissuaded from trying to publish it until 1998. When he did Wolfram successfully moved to block the proof from being presented at the conference Cook had intended to use for this purpose, and the proof was not published until 2004. Reference.
A: In the 1920s Alfred Tarski found proofs that if a system of logic had either {CpCqp, CpCqCCpCqrr} or {CpCqp, CpCqCCpCqrCsr} as theses of the system, then it has a basis which consists of a single thesis.  In other words, if both of {CpCqp, CpCqCCpCqrr} or both of {CpCqp, CpCqCCpCqrCsr} belong to some system S, then S has a single formula which can serve as the sole axiom for proving all other theses of the system.  The proof never got published, but did seem known to several authors for a while.  Then it got lost.  A few years later, proofs of Tarski's results did get found.
A: Onsager announced in 1948 that he and Kaufman had found a proof for the fact that the spontaneous magnetization of the Ising model on the square lattice with couplings $J_1$ and $J_2$ is given by
$M = \left(1 - \left[\sinh 2\beta J_1 \sinh 2\beta J_2\right]^{-2}\right)^{\frac{1}{8}}$
But he kept the proof a secret as a challenge to the physics community. The proof was obtained by Yang in 1951
A: I do not know whether this is appropriate for an answer: the work being
secret, I cannot tell what it is (this is not a joke). And I would not
be enough of a mathematician to describe it anyway.
It concerns Alexander Grothendieck, 86 today, winner of the Fields Medal in
1966. My original information is from the French magazine La Recherche,
n°486, April 2014 (Unfortunately I do not have my copy with me to
check details). Another account is available on the web, also in French.
Apparently this is in relation with a documentary film made recently about him.
He is now retired in a small village in the Pyrenean Mountains since
1991, at the age of 63. At that date he left the University of
Montpellier where "*he left with Jean Malgoire 20,000 pages of notes
and letters written in the course of 15 years". Malgoire and two
colleagues, Matthias Künzer and Georges Maltsiniotis, analyzed some of
it and extracted Grothendieck's concept of derivator.
But this is only a small part of the 20,000 pages of mathematical writing, most of which has
not been examined, and which he does not want to be published, and
would rather have destroyed, since he started opposing scientific research
for ideological reasons.
According to Michel Demazure, it may take fifty years or more to figure
out  all these unpublished documents.
I think there are supposed to be more documents in his current home, but I do not have
my source handy to check.
A: Descriptive Geometry was invented by Gaspard Monge in 1765 (he was eighteen) for
military applications. For 15 years (possibly more) it was classified
and kept as a military secret.
It is a geometric technique to represent 3-dimensional objects through projections on planes. It allows 3D geometric constructions similar to what is usually done in 2D, through correspondence of points between the projections. It was used at the time for fortification design.
A: Fermat announced many of his results, but released very few details of his proofs, so his methods could be considered for the most part to have been kept secret. 
Often he challenged others in written correspondence to solve problems that he claimed to be able to do, such as finding nontrivial integral solutions to some Pell equations (he offered the example of $x^2 - 61y^2 = 1$, where he said he chose the coefficient 61 because it is small and shouldn't be too much work, whereas in fact the first solution in positive integers is unusually large, so it was not a random example) or finding all solutions in positive integers to $y^2 = x^3 - 2$ (the only one is $(x,y) = (3,5)$) or showing every prime that is 1 mod 4 is a sum of two squares.
He hoped these public challenges would inspire others to get interested in number theory, but this goal was largely unsuccessful in his lifetime. It took about 100 more years for anyone to really pick up where Fermat left off, and that person was Euler. All he had to start off with were the claims by Fermat of what he could do, and proofs of everything had to be reconstructed, assuming Fermat had proofs at all. To this day only one proof of Fermat in his own writing is known (that 1 and 2 are not "congruent numbers" based on his method of descent).
Of course the most famous challenge by Fermat was Fermat's last theorem, but that is not in the same category as his usual challenges because it was a result he wrote to himself in one of his books and was not intended for others. So in a sense the statement of FLT itself could be considered secret, but it doesn't really fit the parameters of the question as Fermat was almost certainly wrong about having a proof in this case.
A: I think Gauss anticipated non-euclidian geometries, and kept it quite because he was afraid of how controversial it was. He actually had a dispute with Janos Bolyai, who thought he was stealing his idea.
There is information about this contained here
A: Even great Gauss withheld his unpublished non-Euclidean geometry findings as per his own admission due to .. ( Geschrie der Bootier, outcry of "ordinary" people or the like ..I don't know its correct translation from German), a fear of proposing something outrageously different... Anyway it nipped out most of the younger Bolyai's enthusiasm.
A: As a probabilist, I cannot not mention the following, very fascinating to me, story of the life of Döblin and his relationship with the formula (almost) universally known as Itō formula http://en.wikipedia.org/wiki/Wolfgang_D%C3%B6blin
A: Niccolò “Tartaglia” Fontana invented the first general method to find the roots of an arbitrary cubic equation (based on earlier work by himself and others on how to solve cubics of particular forms), but kept his method secret so as to preserve his advantage in problem-solving competitions with other mathematicians.
He divulged the secret to his student Gerolamo Cardano on condition that Cardano keep the secret, and there was a bitter dispute between the two when Cardano broke his promise.
A: Differential cryptanalysis:

In 1994, a member of the original IBM DES team, Don Coppersmith, published a paper stating that differential cryptanalysis was known to IBM as early as 1974, and that defending against differential cryptanalysis had been a design goal. According to author Steven Levy, IBM had discovered differential cryptanalysis on its own, and the NSA was apparently well aware of the technique. IBM kept some secrets, as Coppersmith explains: "After discussions with NSA, it was decided that disclosure of the design considerations would reveal the technique of differential cryptanalysis, a powerful technique that could be used against many ciphers. This in turn would weaken the competitive advantage the United States enjoyed over other countries in the field of cryptography." Within IBM, differential cryptanalysis was known as the "T-attack" or "Tickle attack".

Diffie-Hellman:

The scheme was first published by Whitfield Diffie and Martin Hellman in 1976, although it had been separately invented a few years earlier within GCHQ, the British signals intelligence agency, by James H. Ellis, Clifford Cocks and Malcolm J. Williamson but was kept classified.

A: Two cases of mathematical secret from the Second World War: Abraham Wald and Alan Turing.
Though apparently technically related (according to Wikipedia), these two cases were actually independent of each other, and the mathematics used for very different purposes.
Some fifty years ago, I read that Bellman optimization principle had
been kept a secret. It took me some time to sort this out, with the
help of the internet, as the information was not fully accurate. But
it was apparently almost true.
Actually, the mathematical technique kept secret was the related work
of Abraham Wald on sequential analysis.
Here is a (hopefully) more accurate version of the story, translated from the
French, from the page 145, in chapter 4 on Dynamic Programming of a Swiss
engineering book: Recherche opérationnelle pour ingénieurs, Volume 2
By Jean-François Hêche, Thomas M. Liebling, Dominique de Werra, PPUR
(Presses Polytechniques et Universitaires Romandes), 2003,ISBN: 2 88074 459 8.

Like most models and methods of Operations Resarch, Dynamic
  Programming is, too, a by-product od the Second World War. It is
  indeed during that conflict, with the concern of improving the
  effectiveness of quality control in the production of ammunition, that
  the American mathematician Abraham Wald proposes a new method that he
  name sequential analysis. The main idea of his approach resides in
  the replacement of traditionnal sampling with fixed size by a process
  in which it is decided dynamycally whether the accumulated evidence is
  sufficient, or whether, to the contrary, further test must be
  performed. This method being particularly efficient, it remains
  classified as a military secret even after the war, and it is only in
  1947 that it becomes awailable to the public. Very soon afterwards,
  at the Rand Corporation of California, independently from Wald, but
  also in a military context, Richard Bellman becomes interested in
  optimal control, and, more generally, in sequential optimization
  problems. He originated the name dynamic programming and made the
  methodology known in his reference work of 1957. It is in this book
  that Bellman proposes his optimality principle which states that any
  shortest path is itself composed of shortest paths.

This is confirmed by looking in Wikipedia at the page on sequential
analysis, which lists other contributors, but has no reference to
Bellman principle. I do not know sequential analysis, and cannot
assess at this time whether it is appropriate to disconnect sequential
analysis from the later work of Bellman, as is done in wikipedia.
But this same wikipedia page raises another case of secrecy in mathematics,
concerning a similar approach used by Alan Turing in his cryptographic
work, which remained secret until the 1980s :

A similar approach was independently developed at the same time by
  Alan Turing, as part of the Banburismus technique used at Bletchley
  Park, to test hypotheses about whether different messages coded by
  German Enigma machines should be connected and analysed together. This
  work remained secret until the early 1980s.

Boldface used in citations is mine, not from the original text.
A: The Decimal System of representation of Numbers and Rational and Irrational Fractions were well guarded secret. Indian Astronomers used it for Astronomical and Astrological calculations. The formulas are written in symbolic form in the Vedas, believed to have been composed around 1500 BC. From this Wikipedia page,

... Evidence of early use of a zero glyph present in Bakhshali
  manuscript, a text of uncertain date, possibly a copy of a text
  composed as early as the 2nd century BC.

Only around 9th Century AD, Khwārizmī translated this Hindu decimal positional number system in Persian which was further introduced to Western world in twelfth century through Latin translation. 
In the article "Overview of Indian mathematics", Laplace wrote:-

The ingenious method of expressing every possible number using a set
  of ten symbols (each symbol having a place value and an absolute
  value) emerged in India. The idea seems so simple nowadays that its
  significance and profound importance is no longer appreciated. Its
  simplicity lies in the way it facilitated calculation and placed
  arithmetic foremost amongst useful inventions. the importance of this
  invention is more readily appreciated when one considers that it was
  beyond the two greatest men of Antiquity, Archimedes and Apollonius.

A: One example of hidden results would be those of Johann Bernoulli when he was paid by l'Hôpital to keep his results secret to everyone else. As a result, l'Hôpital wrote a Calculus book which Bernoulli would later reveal was largely his work. What is nowadays known as l'Hôpital's rule was actually a result of Bernoulli attributed to l'Hôpital.
