You're correct. In mathematics, the equals sign is transitive, meaning that if $a = b$ and $b = c$, then $a = c$, which is exactly what is going on here. It doesn't really change with $\sin x$ and $\cos x$ or any other trigonometric function since they are functions from $\mathbb{R}$ to $\mathbb{R}$, meaning that they return real numbers.