We solve the functional equation \( f(x\sigma (y)) = f(x)g(y)+f(y)g(x)-g(x)g(y),\ x,y\in S, \) for complex-valued functions f, g on semigroups, where \(\sigma :S\rightarrow S\) is an automorphism. Furthermore, we show that its variant \( f(\sigma (y)x) = f(x)g(y)+f(y)g(x)-g(x)g(y),\ x,y\in S, \) have the same solutions. As an application, we solve the functional equation \( f(x\sigma (y))=f(x)g(y)+f(y)g(x)+\alpha g(x\sigma (y)),\ x,y\in S, \) where \(\alpha \in \mathbb {C}\backslash \lbrace 0\rbrace \) is a fixed constant.