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 Number Theory →

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 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