Does Coke cause teeth discoloration and if so what ingredient in it causes this?

Yes, Coke is one of the many drinks that can cause teeth staining. A cleaining in a dental office should remove all or most of the stains. I'm not sure the ingredient that stains the teeth, but it's probably the dye's in it or maybe the caffeine. Any dark pop/soda will stain your teeth. Coffee and tea also.

i think it is the dye

Yes coke does cause stains and alot of them. I think the caramel color is the staining ingredient and the dyes.

Not just discoloration but it also causes cavities.

Absolutely. Haven`t had cavities in 17 years, started drinking diet coke for one year and ended up with 6 cavities. Not to mention the discoloration.