We introduce the functional equation \(g(xyz) - g(x)g(yz) - g(y)g(xz) - g(z)g(xy) + 2g(x)g(y)g(z) = 0\) for an unknown function g mapping a semigroup S into a field K. It seems reasonable to call this a cosine functional equation because when \(S = ({\mathbb R},+)\) and \(K = {\mathbb R}\) the function \(g = \cos \) is a solution. It is not very surprising to find that this equation has a strong connection with the sine addition formula. We show that for any solution g there exists a function \(f:S \rightarrow K\) such that \(f(xy) = f(x)g(y) + g(x)f(y)\) for all \(x,y \in S\) . The converse is true if \(f \ne 0\) . For the case \(K = {\mathbb C}\) we show that all solutions of the cosine equation are arithmetic means of two multiplicative functions. Some more general equations are also solved.