Cosine in LaTeX (\cos)

cos⁡\cos
LaTeX command
\cos
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Cosine function, typeset upright as a named math operator like \sin.

\cos appears in the law of cosines c^2 = a^2 + b^2 - 2ab\cos C, in Euler's formula e^{i\theta} = \cos\theta + i\sin\theta, and in the angle form of the dot product, where cosine similarity in machine learning comes from. Typing cos without a backslash gives italic letters and wrong spacing. Write \cos^2\theta for the square of the cosine; \cos\theta^2 means the cosine of theta squared, which is a different quantity. The command takes no argument itself, so group compound arguments with parentheses, as in \cos(\omega t + \phi).

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab \cos C
\documentclass{article}
\begin{document}
Cosine: $\cos$

\[ c^2 = a^2 + b^2 - 2ab \cos C \]
\end{document}

Related symbols

All Trigonometry →

Frequently asked questions

How do I write Cosine in LaTeX?
Type \cos in math mode, for example $c^2 = a^2 + b^2 - 2ab \cos C$. It works in plain LaTeX without loading any package.
Which package do I need for \cos?
None. \cos is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \cos in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\cos$ in running text.
Math poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers