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 علم المثلثات →

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 poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث