What is the difference between a ylide and a betaine?

I'm not sure what the exact difference between a ylide and a betaine is...


Are both zwitterions?


Something along the lines of: ALL ylides are betaines, but not all betains are ylides(according to [wikipedia](https://en.wikipedia.org/wiki/Betaine) the cation/anion group can be adjacent or nonadjacent)?




The more definitive source for chemistry terminology is the IUPAC Gold Book.


[Betaine](http://goldbook.iupac.org/B00637.html)



> 
> Originally, the compound betaine, $\ce{(CH3)3N+–CH2C(=O)O−}$ (*N*,*N*,*N*-trimethylammonioacetate), and similar zwitterionic compounds derived from other amino acids. By extension, neutral molecules having charge-separated forms with an onium atom which bears no hydrogen atoms and that is not adjacent to the anionic atom. Betaines cannot be represented without formal charges.
> 
> 
> 


[Ylides](http://goldbook.iupac.org/Y06728.html)



> 
> Compounds in which an anionic site $\ce{Y−}$ (originally on carbon, but now including other atoms) is attached directly to a heteroatom $\ce{X+}$ (usually nitrogen, phosphorus or sulfur) carrying a formal positive charge. They are thus 1,2-dipolar species of the type $\ce{R\_mX+–Y−R\_n}$. 
> 
> 
> 


So, ylides are not betaines and betaines are not ylides. Primarily due to the atoms in a ylide that contain the charges must be adjacent, and in betaines they must not be adjacent.


An example of a ylid would be the phosphonium ylid used in Wittig chemistry:


[![Ylid](https://i.stack.imgur.com/mDK8o.png)](https://i.stack.imgur.com/mDK8o.png)


Since it has adjacent positive and negative charges, it is classified as a ylid.


The addition of this ylid to a carbonyl compound would form a betaine *(note that the mechanism of the Wittig reaction is now thought to be a concerted [2+2] cycloaddition leading to the oxaphosphetane immediately, without the intermediacy of the betaine)*:


[![Betaine](https://i.stack.imgur.com/EBufh.png)](https://i.stack.imgur.com/EBufh.png)


Note that the ylid has an alternate resonance form (the one with a P=C double bond) which has no formal charges, whereas the betaine cannot be drawn without formal charges.


 9