Legendre Symbol in LaTeX (\left(\frac{a}{p}\right))

(ap)\left(\frac{a}{p}\right)
LaTeX command
\left(\frac{a}{p}\right)
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Legendre symbol (a/p): 1, -1 or 0 depending on whether a is a quadratic residue mod p.

For an odd prime p, \left(\frac{a}{p}\right) equals 1 if a is a nonzero square modulo p, -1 if it is not, and 0 if p \mid a. Quadratic reciprocity is the famous identity relating \left(\frac{p}{q}\right) and \left(\frac{q}{p}\right) through the sign (-1)^{\frac{p-1}{2}\frac{q-1}{2}}. \left( \right) sizes the parentheses to the fraction automatically. Do not use \binom, which omits the fraction bar the symbol requires; \genfrac{(}{)}{}{}{a}{p} is an equivalent alternative. Euler's criterion computes it as a^{(p-1)/2} modulo p.

Minimal compilable example

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

(ap)≡a(p−1)/2(modp)\left(\frac{a}{p}\right) \equiv a^{(p-1)/2} \pmod{p}
\documentclass{article}
\begin{document}
Legendre Symbol: $\left(\frac{a}{p}\right)$

\[ \left(\frac{a}{p}\right) \equiv a^{(p-1)/2} \pmod{p} \]
\end{document}

Related symbols

All نظرية الأعداد →

Frequently asked questions

How do I write Legendre Symbol in LaTeX?
Type \left(\frac{a}{p}\right) in math mode, for example $\left(\frac{a}{p}\right) \equiv a^{(p-1)/2} \pmod{p}$. It works in plain LaTeX without loading any package.
Which package do I need for \left(\frac{a}{p}\right)?
None. \left(\frac{a}{p}\right) is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \left(\frac{a}{p}\right) in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\left(\frac{a}{p}\right)$ in running text.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

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

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

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