Trigonometric functions in LaTeX
Updated:
Write function names with \sin, \cos and \tan. They are set upright with the right spacing before the argument. For a function that has no built-in command, such as sgn or arcsinh in older setups, use \operatorname.
Pythagorean identity
\sin^2 \alpha + \cos^2 \alpha = 1The power goes straight after the function name: \sin^2 \alpha. This is the standard way to write the square of the sine and it needs no extra brackets.
Copying this from handwritten notes? Snap a photo of the page and CamteX turns the formulas into LaTeX. Try it free
Tangent and a custom operator
\tan x = \frac{\sin x}{\cos x}, \quad \operatorname{sgn} x\operatorname gives any name the same upright font and spacing as \sin. In a longer document declare it once in the preamble with \DeclareMathOperator{\sgn}{sgn}.
Inverse function
\arcsin x, \quad \sin^{-1} x\arcsin, \arccos and \arctan are built in. \sin^{-1} x is common too, but keep one notation in a report so it is not mistaken for 1 over \sin x.
Degrees
\sin 30^\circ = \frac{1}{2}The degree sign is ^\circ in math mode. With the siunitx package, \ang{30} prints the same and keeps the spacing consistent with the other units in the document.
Argument with several terms
x(t) = A \sin(\omega t + \varphi)An argument made of several terms needs brackets. \left and \right are only worth adding when the argument contains a fraction or another tall element.
Hyperbolic functions
\sinh x, \quad \cosh x, \quad \tanh xThe hyperbolic functions have their own commands as well. Their inverses such as arcsinh are missing from standard LaTeX, so write them with \operatorname{arcsinh}.
Common mistakes
- sin x without a backslash: it is set in italics as the product s·i·n·x.
- \sin(x)^2 instead of \sin^2 x: the power attaches to the bracket, not to the function.
- \sin^-1 x without braces: only the minus sign goes up. Write \sin^{-1} x.
See also
Don't want to memorize commands?
Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.