The production of the cannabinoids THC and CBD are a result of a series of chemical reactions, and are just two types of over a hundred that are known.  Inside the transcriptomes of glandular trichomes in the cannabis plant, the pathway for cannabinoid production takes place. Beginning with the formation of 3,5,7-trioxododecaneoyl-COA by the condensation reaction between hexanoyl-CoA and  malonyl-CoA, catalyzed by type III polyketide synthase (PKS), the product is then used to form olivetolic acid. After the geranylation of olivetolic acid, cannabigerolic acid (CBGA) or cannabigerivarinic acid (CBGVA) is formed. The decarboxylation of these acids yield what we recognize as THC and CBD.