Why do we see sometimes see a rainbow around the moon or sun.

Because the light often refracts the particles to create the colors of the rainbow.

Since this is not my area of expertise, I searched Google under the key words "moon halo" to get these possible sources:

http://antwrp.gsfc.nasa.gov/apod/ap000515.html
http://home.hiwaay.net/~krcool/Astro/moon/moonring/
http://ww2010.atmos.uiuc.edu/(Gh)/guides/mtr/opt/ice/halo/22.rxml

Under "moon rainbow," I found:

http://www.time.com/time/magazine/article/0,9171,760103,00.html

Under "lunar rainbow," I founde:

http://en.wikipedia.org/wiki/Moonbow
http://www.eo.ucar.edu/rainbows/
http://www.atoptics.co.uk/rainbows/moonbow.htm

In the future, you can find the information you desire more quickly, if you use appropriate key words to do your own search.

I hope this helps a little more.Thanks for asking.

The phenomenon you are referring to is known as a moon or sun halo. It occurs when light from the moon or sun is refracted or bent in ice crystals or water droplets in the atmosphere. This refraction causes the light to break apart into its component colors, just like a rainbow. The ice crystals or water droplets act like tiny prisms, scattering the light and creating a ring of colored light around the moon or sun.

To see a moon or sun halo, you need specific atmospheric conditions. These conditions include the presence of high-altitude cirrus clouds or ice crystals in the upper atmosphere. The crystals or droplets need to be large and uniform enough to refract the light and create the halo effect.

If you want to learn more about moon or sun halos, you can search keywords such as "moon halo," "sun halo," or "lunar rainbow" on search engines like Google. You will find various websites, articles, and scientific explanations that provide more in-depth information on the subject. It's always a good idea to use specific and relevant keywords when searching to get accurate and relevant results.

I hope this explanation helps you understand why we sometimes see a rainbow around the moon or sun. Let me know if you have any more questions!