Cocamide is a mixture of amides manufactured from the fatty acids obtained from coconut oil.
As coconut oil contains about 50% of lauric acid, in formulas only the 12-carbon chains tend to be considered.
[1] Therefore the formula of cocamide can be written as CH3(CH2)10CONH2, though the number of carbon atoms in the chains varies (it is always even).
[2] Cocamide is the structural basis of many surfactants.
Common are ethanolamines (cocamide MEA, cocamide DEA), betaine compounds (cocamidopropyl betaine), and hydroxysultaines (cocamidopropyl hydroxysultaine).