Angular frequency: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
Correct punctuation
en>Hhhippo
m Reverted 1 edit by 70.162.2.231 (talk) to last revision by Trappist the monk. (TW)
Line 1: Line 1:
In [[number theory]], an [[integer]] ''q'' is called a '''quadratic residue''' [[modular arithmetic|modulo]] ''n'' if it is [[Congruence relation|congruent]] to a [[Square number|perfect square]] modulo ''n''; i.e., if there exists an integer ''x'' such that:
Hi there. Mƴ namе is Demetra and Ӏ totally dig thаt title. Ӏn mʏ [http://Pinterest.com/search/pins/?q=expert+lifestyle expert lifestyle] ӏ am a journey agent. Hеr spouse doesn't like it   [http://www.heavenlywallpapers.com/profile/asconeybee Sveriges bästa casino] tҺе waʏ she ɗoes ƅut what she truly likes performing  [http://www.purevolume.com/danazbqkvtnmc/posts/7119968/How+To+Make+Your+N%C3%A4tcasinon+Look+Like+A+Million+Bucks ultimata casinosidorna tillsammans] is playing dominoes and ѕhe would by no means givе it up. Yеars ago he moved tо Michigan ɑnd hе haѕ eνerything tҺat ɦe neeɗs therе. Go to my web site to find ߋut moгe: https://serpinjector.zendesk.com/entries/53722750-Gestalta-Villig-Online-Kasinon-Is-Essential-For-Your-Success-Read-This-To-Find-Out-Why<br><br>


:<math>x^2\equiv q \pmod{n}.</math>
Review my [https://Www.google.com/search?hl=en&gl=us&tbm=nws&q=web+site&btnI=lucky web site] - [https://serpinjector.zendesk.com/entries/53722750-Gestalta-Villig-Online-Kasinon-Is-Essential-For-Your-Success-Read-This-To-Find-Out-Why casinon]
 
Otherwise, ''q'' is called a  '''quadratic nonresidue''' modulo ''n''.
 
Originally an abstract [[mathematics|mathematical]] concept from the branch of number theory known as modular arithmetic, quadratic residues are now used in applications ranging from acoustical engineering to [[cryptography]] and the [[Integer factorization|factoring of large numbers]].
 
==History, conventions, and elementary facts==
[[Fermat]], [[Euler]], [[Joseph Louis Lagrange|Lagrange]], [[Adrien-Marie Legendre|Legendre]], and other number theorists of the 17th and 18th centuries proved some theorems<ref>Lemmemeyer, Ch. 1</ref> and made some conjectures<ref>Lemmermeyer, pp 6&ndash;8, p. 16 ff</ref> about quadratic residues, but the first systematic treatment is § IV of [[Gauss|Gauss's]] ''[[Disquisitiones Arithmeticae]]'' (1801). Article 95 introduces the terminology "quadratic residue" and "quadratic nonresidue", and states that, if the context makes it clear, the adjective "quadratic" may be dropped.
 
For a given ''n'' a list of the quadratic residues modulo ''n'' may be obtained by simply squaring the numbers 0, 1, …, ''n'' &minus; 1. Because ''a''<sup>2</sup> ≡ (''n'' &minus; ''a'')<sup>2</sup> (mod ''n''), the list of squares modulo ''n'' is symmetrical around ''n''/2, and the list only needs to go that high. This can be seen in the table [[#Table of quadratic residues|below]].
 
Thus, the number of quadratic residues modulo ''n'' cannot exceed ''n''/2 + 1 (''n'' even) or (''n'' + 1)/2 (''n'' odd).<ref>Gauss, DA, art. 94</ref>
 
The product of two residues is always a residue.
 
===Prime modulus===
 
Modulo 2, every integer is a quadratic residue.
 
Modulo an odd [[prime number]] ''p'' there are (''p'' + 1)/2 residues (including 0) and (''p'' &minus; 1)/2 nonresidues. In this case, it is customary to consider 0 as a special case and work within the  [[Multiplicative group of integers modulo n|multiplicative group of nonzero elements]] of the [[Field (mathematics)|field]] '''Z/''p''Z'''. (In other words, every congruence class except zero modulo ''p'' has a multiplicative inverse. This is not true for composite moduli.)<ref name="Gauss, DA, art. 96">Gauss, DA, art. 96</ref>
 
Following this convention, the multiplicative inverse of a residue is a residue, and the inverse of a nonresidue is a nonresidue.<ref name="Gauss, DA, art. 98">Gauss, DA, art. 98</ref>
 
Following this convention, modulo a prime number there are an equal number of residues and nonresidues.<ref name="Gauss, DA, art. 96"/>
 
Modulo a prime, the product of two nonresidues is a residue and the product of a nonresidue and a (nonzero) residue is a nonresidue.<ref name="Gauss, DA, art. 98"/>
 
The first supplement<ref>Gauss, DA, art 111</ref> to the [[law of quadratic reciprocity]] is that if ''p'' ≡ 1 (mod 4) then &minus;1 is a quadratic residue modulo ''p'', and if ''p'' ≡ 3 (mod 4) then &minus;1 is a nonresidue modulo ''p''. This implies the following:
 
If ''p'' ≡ 1 (mod 4) the negative of a residue modulo ''p'' is a residue and the negative of a nonresidue is a nonresidue.
 
If ''p'' ≡ 3 (mod 4) the negative of a residue modulo ''p'' is a nonresidue and the negative of a nonresidue is a residue.
 
===Prime power modulus===
All odd squares are ≡ 1 (mod 8) and ''a fortiori'' ≡ 1 (mod 4). If ''a'' is an odd  number and ''m'' = 8, 16, or some higher power of 2, then ''a'' is a residue modulo ''m'' if and only if ''a'' ≡ 1 (mod 8).<ref>Gauss, DA, art. 103</ref>
 
<blockquote>For example, mod (32) the odd squares are
:1<sup>2</sup> &equiv; 15<sup>2</sup> &equiv; 1
:3<sup>2</sup> &equiv; 13<sup>2</sup> &equiv; 9
:5<sup>2</sup> &equiv; 11<sup>2</sup> &equiv; 25
:7<sup>2</sup> &equiv; 9<sup>2</sup> &equiv; 17
 
and the even ones are
:0<sup>2</sup> &equiv; 8<sup>2</sup> &equiv; 16<sup>2</sup> &equiv; 0
:2<sup>2</sup> &equiv; 6<sup>2</sup>&equiv; 10<sup>2</sup> &equiv; 14<sup>2</sup>&equiv; 4
:4<sup>2</sup> &equiv; 12<sup>2</sup> &equiv; 16.
 
</blockquote>
 
So a nonzero number is a residue mod 8, 16, etc., if and only if it is of the form 4<sup>''k''</sup>(8''n'' + 1).
 
A number ''A'' relatively prime to an odd prime ''p'' is a residue modulo any power of ''p'' if and only if it is a residue modulo ''p''.<ref name="Gauss, DA, art. 101">Gauss, DA, art. 101</ref>
 
If the modulus is ''p''<sup>''n''</sup>,
:then ''p''<sup>''k''</sup>''A''
::is a residue modulo ''p''<sup>''n''</sup> if ''k'' &ge; ''n''
::is a nonresidue modulo ''p''<sup>''n''</sup> if ''k'' &lt; ''n'' is odd
::is a residue modulo ''p''<sup>''n''</sup> if ''k'' &lt; ''n'' is even and ''A'' is a residue
::is a nonresidue modulo ''p''<sup>''n''</sup> if ''k'' &lt; ''n'' is even and ''A'' is a nonresidue.<ref>Gauss, DA, art. 102</ref>
 
Notice that the rules are different for powers of two and powers of odd primes.
 
Modulo an odd prime power ''n'' = ''p''<sup>''k''</sup>, the products of residues and nonresidues relatively prime to ''p'' obey the same rules as they do mod ''p''; ''p'' is a nonresidue, and in general all the residues and nonresidues obey the same rules, except that the products will be zero if the power of ''p'' in the product ≥ ''n''.
 
Modulo 8, the product of the nonresidues 3 and 5 is the nonresidue 7, and likewise for permutations of 3, 5 and 7. In fact, the multiplicative group of the non-residues and 1 form the [[Klein four-group]].
 
===Composite modulus not a prime power===
 
The basic fact in this case is
:if ''a'' is a residue modulo ''n'', then ''a'' is a residue modulo ''p''<sup>''k''</sup> for ''every'' prime power dividing ''n''.
:if ''a'' is a nonresidue modulo ''n'', then ''a'' is a nonresidue modulo ''p''<sup>''k''</sup> for ''at least one'' prime power dividing ''n''.
 
Modulo a composite number, the product of two residues is a residue. The product of a residue and a nonresidue may be a residue, a nonresidue, or zero.
 
<blockquote>
For example, from the table for modulus 6 &nbsp;
'''1''', 2, '''3''', '''4''', 5 (residues in '''bold''').
 
The product of the residue 3 and the nonresidue 5 is the residue 3, whereas the product of the residue 4 and the nonresidue 2 is the nonresidue 2.
 
</blockquote>
 
Also, the product of two nonresidues may be either a residue, a nonresidue, or zero.
 
<blockquote>
For example, from the table for modulus 15 &nbsp;
'''1''', 2, 3, '''4''', 5, '''6''', 7, 8,  '''9''', '''10''', 11, 12, 13, 14 (residues in '''bold''').
 
The product of the nonresidues 2 and 8 is the residue 1, whereas the product of the nonresidues 2 and 7 is the nonresidue 14.
 
</blockquote>
 
This phenomenon can best be described using the vocabulary of abstract algebra. The congruence classes relatively prime to the modulus are a [[Group (mathematics)|group]] under multiplication, called the [[group of units]] of the [[Ring (mathematics)|ring]] '''Z/''n''Z''', and the squares are a [[subgroup]] of it. Different nonresidues may belong to different [[coset]]s, and there is no simple rule that  predicts which one their product will be in. Modulo a prime, there is only the subgroup of squares and a single coset.
 
The fact that, e.g., modulo 15 the product of the nonresidues 3 and 5, or of the nonresidue 5 and the residue 9, or the two residues 9 and 10 are all zero comes from working in the full ring '''Z/''n''Z''', which has [[zero divisor]]s for composite ''n''.
 
For this reason some authors<ref>e.g., {{harvnb|Ireland|Rosen|1990|p=50}}</ref> add to the definition that a quadratic residue ''q'' must not only be a square but must also be [[relatively prime]] to the modulus ''n''.
 
Although it makes things tidier, this article does not insist that residues must be coprime to the modulus.
 
==Notations==
 
Gauss<ref>Gauss, DA, art. 131</ref> used '''R''' and '''N''' to denote residuacity and non-residuacity, respectively;
:for example, 2 R 7 and 5 N 7, or 1 R 8 and 3,5,7 N 8.
 
Although this notation is compact and convenient for some purposes,<ref>e.g. Hardy and Wright use it</ref><ref>Gauss, DA, art 230 ff.</ref> a more useful notation is the [[Legendre symbol]], also called the [[Dirichlet character#Examples|quadratic character]], which is defined for all integers ''a'' and positive odd [[prime numbers]] ''p'' as
:<math>
\left(\frac{a}{p}\right) = \begin{cases}\;\;\,0\mbox{ if }p \mbox { divides } a\\+1\mbox{ if }a \mbox{ R } p \mbox{ and }p \mbox { does not divide } a\\-1\mbox{ if }a \mbox{ N  } p .\end{cases}</math>
 
There are two reasons why numbers ≡ 0 (mod ''p'') are treated specially. As we have seen,  it makes many formulas and theorems easier to state. The other (related) reason is that the quadratic character is a [[homomorphism]] from the [[multiplicative group of integers modulo n|multiplicative group of nonzero conguence classes modulo ''p'']] to the [[complex numbers]]. Setting <math>(\tfrac{np}{p}) = 0</math>  allows its [[Domain (mathematics)|domain]] to be extended to the multiplicative [[semigroup]] of all the integers.<ref>This extension of the domain is necessary for defining ''L'' functions.</ref>
 
One advantage of this notation over Gauss's is that the Legendre symbol is a function that can be used in formulas.<ref>See [[Legendre symbol#Formulas for the Legendre symbol]] for examples</ref>  It can also easily be generalized to [[Cubic reciprocity|cubic]], quartic and higher power residues.<ref>Lemmermeyer, pp 111&ndash;end</ref>
 
There is a generalization of the Legendre symbol for composite values of ''p'', the [[Jacobi symbol]], but its properties are not as simple: if ''m'' is composite and the Jacobi symbol <math>(\tfrac{a}{m}) = -1,</math> then ''a''&nbsp;N&nbsp;''m'', and if ''a''&nbsp;R&nbsp;''m'' then <math>(\tfrac{a}{m}) = 1,</math> but if <math>(\tfrac{a}{m}) = 1</math> we do not know whether ''a''&nbsp;R&nbsp;''m'' or ''a''&nbsp;N&nbsp;''m''. If ''m'' is prime, the Jacobi and Legendre symbols agree.
 
==Distribution of quadratic residues==
 
Although quadratic residues appear to occur in a rather random pattern modulo ''n'', and this has been exploited in such [[#Applications of quadratic residues|applications]] as [[#Acoustics|acoustics]] and [[#Cryptography|cryptography]], their distribution also exhibits some striking regularities.
 
Using [[Dirichlet's theorem on arithmetic progressions|Dirichlet's theorem]] on primes in arithmetic progressions, the [[law of quadratic reciprocity]], and the [[Chinese remainder theorem]] (CRT) it is easy to see that for any ''M'' > 0 there are primes ''p'' such that the numbers 1, 2, …, ''M'' are all residues modulo ''p''.
<blockquote>For example, if ''p'' ≡ 1 (mod 8), (mod 12), (mod 5) and (mod 28), then by the law of quadratic reciprocity 2, 3, 5, and 7 will all be residues modulo ''p'', and thus all numbers 1&ndash;10 will be. The CRT says that this is the same as ''p'' ≡ 1 (mod 840), and Dirichlet's theorem says there are an infinite number of primes of this form. 2521 is the smallest, and indeed 1<sup>2</sup> ≡ 1, 1046<sup>2</sup> ≡ 2, 123<sup>2</sup> ≡ 3, 2<sup>2</sup> ≡ 4, 643<sup>2</sup> ≡ 5, 87<sup>2</sup> ≡ 6, 668<sup>2</sup> ≡ 7, 429<sup>2</sup> ≡ 8, 3<sup>2</sup> ≡ 9, and  529<sup>2</sup> ≡ 10 (mod 2521).</blockquote>
 
===Dirichlet's formulas===
 
The first of these regularities stems from [[Peter Gustav Lejeune Dirichlet]]'s work (in the 1830s) on the [[class number formula|analytic formula]] for the [[Class number (number theory)|class number]] of binary [[quadratic form]]s.<ref>{{harvnb|Davenport|2000|pp=8&ndash;9, 43&ndash;51}}. These are classical results.</ref> Let ''q'' be a prime number, ''s'' a complex variable, and define a [[Dirichlet L-function]] as
:<math>L(s) = \sum_{n=1}^\infty\left(\frac{n}{q}\right)n^{-s}. </math>
 
Dirichlet showed that if ''q'' ≡ 3 (mod 4), then
:<math>L(1) = -\frac{\pi}{\sqrt q}\sum_{n=1}^{q-1} \frac{n}{q} \left(\frac{n}{q}\right) > 0.</math>
 
Therefore, in this case (prime ''q'' ≡ 3 (mod 4)), the sum of the quadratic residues minus the sum of the nonresidues in the range 1, 2, …, ''q'' &minus; 1 is a negative number.
<blockquote>
For example, modulo 11,
 
:'''1''', 2, '''3''', '''4''', '''5''', 6, 7, 8, '''9''', 10 (residues in '''bold''')
 
:1 + 4 + 9 + 5 + 3 = 22, 2 + 6 + 7 + 8 + 10 = 33, and the difference is &minus;11. </blockquote>
 
In fact the difference will always be an odd multiple of ''q'' if ''q'' > 3.<ref>{{harvnb|Davenport|2000|pp=49&ndash;51}}, (conjectured by [[Carl Gustav Jacob Jacobi|Jacobi]], proved by Dirichlet)</ref> In contrast, for prime ''q'' ≡ 1 (mod 4), the sum of the quadratic residues minus the sum of the nonresidues in the range 1, 2, …, ''q'' &minus; 1 is zero, implying that both sums equal <math>\frac{q(q-1)}{4}</math>.
 
Dirichlet also proved that for prime ''q'' ≡ 3 (mod 4),
:<math>L(1) = \frac{\pi}{\left(2-\left(\frac{2}{q}\right)\right)\!\sqrt q}\sum_{n=1}^\frac{q-1}{2}\left(\frac{n}{q}\right) > 0.</math>
This implies that there are more quadratic residues than nonresidues among the numbers 1, 2, …, (''q'' &minus; 1)/2.
 
<blockquote>For example, modulo 11 there are four residues less than 6 (namely 1, 3, 4, and 5), but only one nonresidue (2).</blockquote>
 
An intriguing fact about these two theorems is that all known proofs rely on analysis; no-one has ever published a simple or direct proof of either statement.<ref>{{harvnb|Davenport|2000|p=9}}</ref>
 
===Pairs of residues and nonresidues===
 
Modulo a prime ''p'', the number of pairs ''n'', ''n'' + 1 where ''n'' R ''p'' and ''n'' + 1 R ''p'', or ''n'' N ''p'' and ''n'' + 1 R ''p'', etc., are almost equal. More precisely,<ref>Lemmermeyer, p. 29 ex. 1.22; cf pp. 26&ndash;27, Ch. 10</ref><ref>Crandall & Pomerance, ex 2.38, pp 106&ndash;108</ref>
 
Let ''p'' be an odd prime. For ''i'', ''j'' = 0, 1 define the sets
:<math>A_{ij}=\left\{k\in\{1,2,\dots,p-2\}: \left(\frac{k}{p}\right)=(-1)^i\land\left(\frac{k+1}{p}\right)=(-1)^j\right\},</math>
and let
:<math>\alpha_{ij} = |A_{ij}|.</math>
 
That is,
:&alpha;<sub>00</sub> is the number of residues that are followed by a residue,
:&alpha;<sub>01</sub> is the number of residues that are followed by a nonresidue,
:&alpha;<sub>10</sub> is the number of nonresidues that are followed by a residue, and
:&alpha;<sub>11</sub> is the number of nonresidues that are followed by a nonresidue.
 
Then if ''p'' ≡ 1 (mod 4)
 
:<math>\alpha_{00} = \frac{p-5}{4},\;\alpha_{01} =\alpha_{10} =\alpha_{11} = \frac{p-1}{4} </math>
 
and if ''p'' ≡ 3 (mod 4)
 
:<math>\alpha_{01} = \frac{p+1}{4},\;\alpha_{00} =\alpha_{10} =\alpha_{11} = \frac{p-3}{4}. </math>
 
<blockquote>For example: (residues in '''bold''')
 
Modulo 17
:'''1''', '''2''', 3, '''4''', 5, 6, 7, '''8''', '''9''', 10, 11, 12, '''13''', 14, '''15''', '''16'''
::''A''<sub>00</sub> = {1,8,15},
::''A''<sub>01</sub> = {2,4,9,13},
::''A''<sub>10</sub> = {3,7,12,14},
::''A''<sub>11</sub> = {5,6,10,11}.
 
Modulo 19
:'''1''', 2, 3, '''4''', '''5''', '''6''', '''7''', 8, '''9''', 10, '''11''', 12, 13, 14, 15, '''16''', '''17''', 18
::''A''<sub>00</sub> = {4,5,6,16},
::''A''<sub>01</sub> = {1,7,9,11,17},
::''A''<sub>10</sub> = {3,8,10,15},
::''A''<sub>11</sub> = {2,12,13,14}. </blockquote>
 
Gauss (1828)<ref>Gauss, ''Theorie der biquadratischen Reste, Erste Abhandlung'' (pp 511&ndash;533 of the ''Untersuchungen über hohere Arithmetik)''</ref> introduced this sort of counting when he proved that if ''p'' ≡ 1 (mod 4) then ''x''<sup>4</sup> ≡ 2 (mod ''p'') can be solved if and only if ''p''&nbsp;=&nbsp;''a''<sup>2</sup>&nbsp;+&nbsp;64&nbsp;''b''<sup>2</sup>.
 
===The Pólya&ndash;Vinogradov inequality===
 
The values of <math>(\tfrac{a}{p})</math> for consecutive values of ''a'' mimic a random variable like a [[coin flip]].<ref>Crandall & Pomerance, ex 2.38, pp 106&ndash;108 discuss the similarities and differences. For example, tossing ''n'' coins, it is possible (though unlikely) to get ''n''/2 heads followed by that many tails. V-P inequality rules that out for residues.</ref> Specifically,
<br>
[[George Pólya|Pólya]] and [[Ivan Matveevich Vinogradov|Vinogradov]] proved<ref>{{harvnb|Davenport|2000|pp=135–137}}, (proof of P&ndash;V, (in fact big-O can be replace by 2); journal references for Paley, Montgomery, and Schur)</ref> (independently) in 1918 that for any nonprincipal [[Dirichlet character]] χ(''n'') modulo ''q'' and any integers ''M'' and ''N'',
:<math>\left|\sum_{n=M+1}^{M+N}\chi(n)\right| =O\left( \sqrt q \log q\right),
</math> in [[big O notation]]. Setting <math> \chi(n) = \left(\frac{n}{q}\right),</math>
 
this shows that the number of quadratic residues modulo ''q'' in any interval of length ''N'' is
:<math>\frac{1}{2}N + O(\sqrt q\log q).</math> It is easy<ref>Planet Math:  Proof of Pólya&ndash;Vinogradov Inequality in [[#External links|external links]]. The proof is  a page long and only requires elementary facts about Gaussian sums</ref> to prove that <math> \left| \sum_{n=M+1}^{M+N} \left( \frac{n}{q} \right) \right| < \sqrt q \log q.</math>
 
In fact,<ref>Pomerance & Crandall, ex 2.38 pp.106&ndash;108. result from  T. Cochrane, "On a trigonometric inequality of Vinogradov", ''J. Number Theory'', 27:9&ndash;16, 1987</ref>  <math> \left| \sum_{n=M+1}^{M+N} \left( \frac{n}{q} \right) \right| < \frac{4}{\pi^2} \sqrt q \log q+0.41\sqrt q +0.61.</math>
 
[[Hugh Montgomery (mathematician)|Montgomery]] and [[Robert Charles Vaughan (mathematician)|Vaughan]] improved this in 1977, showing that, if the [[generalized Riemann hypothesis]] is true then
:<math>\left|\sum_{n=M+1}^{M+N}\chi(n)\right|=O\left(\sqrt q \log  \log q\right).</math>
 
This result cannot be substantially improved, for [[Issai Schur|Schur]] had proved in 1918 that
:<math>\max_N \left|\sum_{n=1}^{N}\left(\frac{n}{q}\right)\right|>\frac{1}{2\pi}\sqrt q</math>
and [[Raymond Paley|Paley]] had proved in 1932 that
:<math>\max_N \left|\sum_{n=1}^{N}\left(\frac{d}{n}\right)\right|>\frac{1}{7}\sqrt d \log \log d</math>
for infinitely many ''d'' &gt; 0.
 
===Least quadratic non-residue===
The least quadratic residue mod ''p'' is clearly 1.  The question of the magnitude of the least quadratic non-residue ''n''(''p'') is more subtle.  The Pólya–Vinogradov inequality above gives O(√''p'' log ''p'').  The best unconditional estimate is ''n''(''p'') ≪ ''p''<sup>θ</sup> for any θ>1/4√e, obtained by estimates of Burgess on [[character sum]]s.<ref name=FI156/>  On the assumption of the [[Generalised Riemann hypothesis]], Ankeny obtained ''n''(''p'') ≪ (log ''p'')<sup>2</sup>.<ref>{{cite book | title=Ten Lectures on the Interface Between Analytic Number Theory and Harmonic Analysis | first=Hugh L. | last=Montgomery | authorlink=Hugh Montgomery (mathematician) | publisher=[[American Mathematical Society]] | year=1994 | isbn=0-8218-0737-4 | zbl=0814.11001 | page=176 }}</ref>  Linnik has shown that the number of ''p'' less than ''X'' such that ''n''(''p'') > X<sup>ε</sup> is bounded by a constant depending on ε.<ref name=FI156>{{cite book | title=Opera De Cribro | first1=John B. | last1=Friedlander | author1-link=John Friedlander | first2=Henryk  | last2=Iwaniec | author2-link=Henryk Iwaniec | publisher=[[American Mathematical Society]] | year=2010 | isbn=0-8218-4970-0 | zbl=1226.11099  | page=156 }}</ref>
 
===Quadratic excess===
Let ''p'' be an odd prime.  The '''quadratic excess''' ''E''(''p'') is the number of quadratic residues on the range (0,''p''/2) minus the number in the range (''p''/2,''p'').  For ''p'' congruent to 1 mod 4, the excess is zero, since −1 is a quadratic residue and the residues are symmetric under ''r'' ↔ ''p''−''r''.  For ''p'' congruent to 3 mod 4, the excess ''E'' is always positive.<ref>{{cite book | first1=Paul T. | last1=Bateman | author1-link=Paul T. Bateman | first2=Harold G. | last2=Diamond | title=Analytic Number Theory | publisher=World Scientific | year=2004 | isbn=981-256-080-7 | zbl=1074.11001 | page=250 }}</ref>
 
==Complexity of finding square roots==
 
That is, given a number ''a'' and a modulus ''n'', how hard is it
# to tell whether an ''x'' solving ''x''<sup>2</sup> ≡ ''a'' (mod ''n'') exists
# assuming one does exist, to calculate it?
 
An important difference between prime and composite moduli shows up here. Modulo a prime ''p'', a quadratic residue ''a'' has 1 + (''a''|''p'')  roots (i.e. zero if ''a'' N ''p'', one if ''a'' ≡ 0 (mod ''p''), or two if ''a'' R ''p'' and gcd(''a,p'') = 1.)
 
In general if a composite modulus ''n'' is written as a product of powers of distinct primes, and there are ''n''<sub>1</sub> roots modulo the first one, ''n''<sub>2</sub> mod the second, …, there will be ''n''<sub>1</sub>''n''<sub>2</sub>… roots modulo ''n''.
 
The theoretical way solutions modulo the prime powers are combined to make solutions modulo ''n'' is called the [[Chinese remainder theorem]]; it can be implemented with an efficient algorithm.<ref>{{Harvnb|Bach|Shallit|1996|p=104 ff}}; it requires O(log<sup>2</sup> ''m'') steps where ''m'' is the number of primes dividing ''n''.</ref>
 
<blockquote>For example:
:Solve x<sup>2</sub> ≡ 6 (mod 15).
::x<sup>2</sup> ≡ 6 (mod 3) has one solution, 0; x<sup>2</sup> ≡ 6 (mod 5) has two, 1 and 4.
:: and there are two solutions modulo 15, namely 6 and 9.
 
:Solve x<sup>2</sub> ≡ 4 (mod 15).
::x<sup>2</sup> ≡ 4 (mod 3) has two solutions, 1 and 2; x<sup>2</sup> ≡ 4 (mod 5) has two, 2 and 3.
:: and there are four solutions modulo 15, namely 2, 7, 8, and 13.
</blockquote>
 
===Prime or prime power modulus===
 
First off, if the modulus ''n'' is prime the [[Legendre symbol]] (''a''|''n'') can be [[Jacobi symbol#Calculating the Jacobi symbol|quickly computed]] using a variation of [[Euclid's algorithm]].;<ref>{{Harvnb|Bach|Shallit|1996|p=113}}; computing (''a''|''n'') requires O(log ''a'' log ''n'') steps</ref> if it is &minus;1 there is no solution.
Secondly, assuming that (''a''|''n'') = 1, if ''n'' ≡ 3 (mod 4), [[Joseph Louis Lagrange|Lagrange]] found that the solutions are given by
:<math>x \equiv  \pm\; a^{(n+1)/4} \pmod{n},</math>
and [[Adrien-Marie Legendre|Legendre]] found a similar solution<ref>Lemmermeyer, p. 29</ref> if ''n'' ≡ 5 (mod 8).
 
For prime ''n'' ≡ 1 (mod 8), however, there is no known formula. [[Shanks&ndash;Tonelli algorithm|Tonelli]]<ref>{{Harvnb|Bach|Shallit|1996|p=156 ff}}; the algorithm requires O(log<sup>4</sup>''n'') steps.</ref> (in 1891) and [[Cipolla's algorithm|Cipolla]]<ref>{{Harvnb|Bach|Shallit|1996|p=156 ff}}; the algorithm requires O(log<sup>3</sup> ''n'') steps and is also nondetermisitic.</ref>  found  efficient algorithms that work for all prime moduli. Both algorithms require finding a quadratic nonresidue modulo ''n'', and there is no efficient deterministic algorithm known for doing that. But since half the numbers between 1 and ''n'' are nonresidues, picking numbers ''x'' at random and calculating the Legendre symbol (''x''|''n'') until a nonresidue is found will quickly produce one.
 
If the modulus ''n'' is a prime power ''n'' = ''p''<sup>''e''</sup>, a solution may be found modulo ''p'' and "lifted" to a solution modulo ''n'' using [[Hensel's lemma]] or an algorithm of Gauss.<ref name="Gauss, DA, art. 101"/>
 
===Composite modulus===
 
If the modulus ''n'' has been factored into prime powers the solution was discussed above.
 
If the Jacobi symbol (''a''|''n'') = &minus;1 then there is no solution. If it is +1, there may or may not be one.
 
If the factorization of ''n'' is not known, and (''a''|''n'') = 1, the problem is known to be equivalent to [[integer factorization]] of ''n'' (i.e. an efficient solution to either problem could be used to solve the other efficiently).
<blockquote>The above discussion indicates how knowing the factors of ''n'' allows us to find the roots efficiently. Say there were an efficient algorithm for finding square roots modulo a composite number. The article [[congruence of squares]] discusses how finding two numbers x and y where ''x''<sup>2</sup> ≡ ''y''<sup>2</sup> (mod ''n'') and ''x'' &ne; ±''y'' suffices to factorize ''n'' efficiently. Generate a random number, square it modulo ''n'', and have the efficient square root algorithm find a root. Repeat until it returns a number not equal to the one we originally squared (or its negative modulo ''n''), then follow the algorithm described in congruence of squares. The efficiency  of the factoring algorithm depends on the exact characteristics of the root-finder (e.g. does it return all roots? just the smallest one? a random one?), but it will be efficient.<ref>Crandall & Pomerance, ex. 6.5 & 6.6, p.273</ref></blockquote>
 
Simply determining whether ''a'' N ''n'' or ''a'' R ''n'' (which can be done efficiently for prime ''n'' by computing the Legendre symbol) is known as the [[quadratic residuosity problem]] when ''n'' is composite. It is not known to be as [[Computational hardness assumption|hard]] as factorization, but is thought to be quite hard.
 
On the other hand, if we want to know if there is a solution for ''x'' less than some given limit ''c'', this problem is [[NP-complete]];<ref>{{harvnb|Manders|Adleman|1978}}</ref> however, this is a [[fixed-parameter tractable]] problem, where ''c'' is the parameter.
 
In general, to determine if a quadratic congruence with composite modulus is solvable use the following theorem:<ref>{{cite book|last=Burton|first=David|title=Elementary Number Theory|year=2007|publisher=McGraw HIll|location=New York|pages=195}}</ref>
 
Let ''n'' > 1, and gcd(''a'',''n'') =1. Then ''x''<sup>2</sup> ≡ ''a'' (mod ''n'') is solvable if and only if:
 
a) The Legendre symbol, (''a''/''p'') = 1 for all odd prime divisors of ''n''.
 
b) ''a'' ≡ 1 (mod 4) if 4|n, but 8 does not divide ''n''; ''a'' ≡ 1 (mod 8) if 8|''n''.
 
Note: This theorem essentially requires that the factorization of ''n'' is known.  Also notice that if gcd(''a'',''n'')=''m'', then the congruence can be reduced to ''a''/''m'' ≡ ''x''<sup>2</sup>/''m'' (mod ''n''/''m''), but then this takes the problem away from being a problem of quadratic congruences (unless ''m'' is a square).
 
==The number of quadratic residues==
 
The list of the number of quadratic residues mod ''n'', for ''n''=1,2,3 ..., looks like:<ref>{{OEIS link|A000224}}</ref>
: 1, 2, 2, 2, 3, 4, 4, 3, 4, 6, 6, 4, 7, 8, 6, 4, 9, 8, 10, 6, 8, 12, 12, 6, 11, 14, 11, 8, 15, 12, 16, 7, 12, 18, 12, 8, 19, 20, 14, 9, 21, 16, 22, 12, 12, 24, 24, 8, 22, 22, 18, 14, 27, 22, 18, 12, 20, 30, 30, 12, 31, 32, 16, 12, 21, ...
 
A formula to count the number of squares mod ''n'' is given by Stangl.<ref>{{Citation |last=Stangl |first=Walter D. |title=Counting Squares in &#8484;<sub>''n''</sub> |journal=Mathematics Magazine |volume=69 |issue=4 |pages=285&ndash;289 |date=October 1996 |url=http://mathdl.maa.org/images/cms_upload/Walter_D22068._Stangl.pdf |doi= }}</ref>
 
==Applications of quadratic residues==
 
===Acoustics===
[[Diffusion (acoustics)#Quadratic-Residue Diffusors|Sound diffusers]] have been based on number-theoretic concepts such as [[primitive root modulo n|primitive roots]] and quadratic residues.<ref>{{cite web|last=Walker|first=R|title=The design and application of modular acoustic diffusing elements|url=http://www.bbc.co.uk/rd/pubs/reports/1990-15.pdf|publisher=BBC Research Department|accessdate=3 June 2012}}</ref>
 
===Graph theory===
 
[[Paley graph]]s are dense undirected graphs, one for each prime ''p'' ≡ 1 (mod 4), that  form an infinite family of [[conference graph]]s, which yield an infinite family of [[symmetric matrix|symmetric]] [[conference matrix|conference matrices]].
 
Paley digraphs are directed analogs of Paley graphs, one for each ''p'' ≡ 3 (mod 4), that yield [[Skew-symmetric matrix|antisymmetric]] conference matrices.
 
The construction of these graphs uses quadratic residues.
 
===Cryptography===
The fact that finding a square root of a number modulo a large composite ''n'' is equivalent to factoring (which is widely believed be a hard problem) has been used for constructing [[cryptography|cryptographic schemes]] such as the [[Rabin cryptosystem]] and the [[oblivious transfer]]. The [[quadratic residuosity problem]] is the basis for the [[Goldwasser-Micali cryptosystem]].
 
The [[discrete logarithm]] is a similar problem that is also used in cryptography.
 
===Primality testing===
 
[[Euler's criterion]] is a formula for the Legendre symbol (''a''|''p'') where ''p'' is prime. If ''p'' is composite the formula may or may not compute (''a''|''p'') correctly. The [[Solovay-Strassen primality test]] for whether a given number ''n'' is prime or composite picks a random ''a'' and computes (''a''|''n'') using a modification of Euclid's algorithm,<ref>{{Harvnb|Bach|Shallit|1996|p=113}}</ref> and also using Euler's criterion.<ref>{{Harvnb|Bach|Shallit|1996|pp=109&ndash;110}}; Euler's criterion requires O(log<sup>3</sup> ''n'') steps</ref> If the results disagree, ''n'' is composite; if they agree, ''n'' may be composite or prime. For a composite ''n'' at least 1/2 the values of ''a'' in the range 2, 3, ...,  ''n'' &minus; 1 will return "''n'' is composite"; for prime ''n'' none will. If, after using many different values of ''a'', ''n'' has not been proved composite it is called a "probable prime".
 
The [[Miller-Rabin primality test]] is based on the same principles. There is a deterministic version of it, but the proof that it works depends on the [[generalized Riemann hypothesis]]; the output from this test is "''n'' is definitely composite" or "either ''n'' is prime or the GRH is false". If the second output ever occurs for a composite ''n'', then the GRH would be false, which would have implications through many branches of mathematics.
 
===Integer factorization===
 
In § VI of the ''Disquisitiones Arithmeticae''<ref>Gauss, DA, arts 329&ndash;334</ref> Gauss discusses two factoring algorithms that use quadratic residues and the [[law of quadratic reciprocity]].
 
Several modern factorization algorithms (including [[Dixon's algorithm]], the [[continued fraction factorization|continued fraction method]], the [[quadratic sieve]], and the [[General number field sieve|number field sieve]]) generate small quadratic residues (modulo the number being factorized) in an attempt to find a [[congruence of squares]] which will yield a factorization. The number field sieve is the fastest general-purpose factorization algorithm known.
 
==Table of quadratic residues==
 
{| class="wikitable" style="text-align:center;"
|+ Quadratic Residues
|-
! x || 1||2|| 3|| 4||5|| 6|| 7|| 8 ||9 ||10|| 11|| 12|| 13|| 14 ||15|| 16|| 17|| 18 ||19|| 20|| 21|| 22|| 23|| 24 ||25
|-
! x<sup>2</sup>
! style="width:25px;"|1
! style="width:25px;"|4
! style="width:25px;"|9
! style="width:25px;"|16
! style="width:25px;"|25
! style="width:25px;"|36
! style="width:25px;"|49
! style="width:25px;"|64
! style="width:25px;"|81
!100|| 121|| 144|| 169|| 196 ||225|| 256|| 289|| 324 ||361 || 400|| 441|| 484|| 529|| 576 ||625
|-
! mod 2
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1
|-
! mod 3
| 1 || 1 || 0
| 1 || 1 || 0
| 1 || 1 || 0
| 1 || 1 || 0
| 1 || 1 || 0
| 1 || 1 || 0
| 1 || 1 || 0
| 1 || 1 || 0
| 1
|-
! mod 4
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1 || 0
| 1
|-
! mod 5
| 1 || 4 || 4 || 1 || 0
| 1 || 4 || 4 || 1 || 0
| 1 || 4 || 4 || 1 || 0
| 1 || 4 || 4 || 1 || 0
| 1 || 4 || 4 || 1 || 0
|-
 
! mod 6
| 1 || 4 || 3 || 4 || 1 || 0
| 1 || 4 || 3 || 4 || 1 || 0
| 1 || 4 || 3 || 4 || 1 || 0
| 1 || 4 || 3 || 4 || 1 || 0
| 1
|-
! mod 7
| 1 || 4 || 2 || 2 || 4 || 1 || 0
| 1 || 4 || 2 || 2 || 4 || 1 || 0
| 1 || 4 || 2 || 2 || 4 || 1 || 0
| 1 || 4 || 2 || 2
|-
 
! mod 8
| 1 || 4 || 1 || 0
| 1 || 4 || 1 || 0
| 1 || 4 || 1 || 0
| 1 || 4 || 1 || 0
| 1 || 4 || 1 || 0
| 1 || 4 || 1 || 0
| 1
|-
 
! mod 9
| 1 || 4 || 0 || 7 || 7 || 0 || 4 || 1 || 0
| 1 || 4 || 0 || 7 || 7 || 0 || 4 || 1 || 0
| 1 || 4 || 0 || 7 || 7 || 0 || 4
|-
 
! mod 10
| 1 || 4 || 9 || 6 || 5 || 6 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 6 || 5 || 6 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 6 || 5
|-
 
! mod 11
| 1 || 4 || 9 || 5 || 3 || 3 || 5 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 5 || 3 || 3 || 5 || 9 || 4 || 1 || 0
| 1 || 4 || 9
|-
 
! mod 12
| 1 || 4 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 4 || 1 || 0
| 1
|-
 
! mod 13
| 1 || 4 || 9 || 3 || 12 || 10 || 10 || 12 || 3 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 3 || 12 || 10 || 10 || 12 || 3 || 9 || 4 || 1
|-
 
! mod 14
| 1 || 4 || 9 || 2 || 11 || 8 || 7 || 8 || 11 || 2 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 2 || 11 || 8 || 7 || 8 || 11 || 2 || 9
|-
 
! mod 15
| 1 || 4 || 9 || 1 || 10 || 6 || 4 || 4 || 6 || 10 || 1 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 1 || 10 || 6 || 4 || 4 || 6 || 10
|-
 
! mod 16
| 1 || 4 || 9 || 0 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 0 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 0 || 9 || 4 || 1 || 0
| 1
|-
 
! mod 17
| 1 || 4 || 9 || 16 || 8 || 2 || 15 || 13 || 13 || 15 || 2 || 8 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16 || 8 || 2 || 15 || 13
|-
 
! mod 18
| 1 || 4 || 9 || 16 || 7 || 0 || 13 || 10 || 9 || 10 || 13 || 0 || 7 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16 || 7 || 0 || 13
|-
 
! mod 19
| 1 || 4 || 9 || 16 || 6 || 17 || 11 || 7 || 5 || 5 || 7 || 11 || 17 || 6 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16 || 6 || 17
|-
 
! mod 20
| 1 || 4 || 9 || 16 || 5 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16 || 5 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16 || 5
|-
 
! mod 21
| 1 || 4 || 9 || 16 || 4 || 15 || 7 || 1 || 18 || 16 || 16 || 18 || 1 || 7 || 15 || 4 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16
|-
 
! mod 22
| 1 || 4 || 9 || 16 || 3 || 14 || 5 || 20 || 15 || 12 || 11 || 12 || 15 ||  20 || 5 || 14 || 3 || 16 ||  9 || 4 || 1 || 0
| 1 || 4 || 9
|-
 
! mod 23
| 1 || 4 || 9 || 16 || 2 || 13 || 3 || 18 || 12 || 8 || 6 || 6 || 8 || 12 ||18 || 3 || 13 || 2 || 16 || 9 || 4 || 1 || 0
| 1 || 4
|-
 
! mod 24
| 1 || 4 || 9 || 16 || 1 || 12 || 1 || 16 || 9 || 4 || 1 || 0
| 1 || 4 || 9 || 16 || 1 || 12 || 1 || 16 || 9 || 4 || 1 || 0
| 1
|-
 
! mod 25
| 1 || 4 || 9 || 16 || 0 || 11 || 24 || 14 || 6 || 0 || 21 || 19  || 19 || 21 || 0 || 6 || 14 || 24 || 11 || 0 || 16 || 9 || 4 || 1 || 0
|}
 
==See also==
*[[Euler's criterion]]
*[[Gauss's lemma (number theory)|Gauss's lemma]]
*[[Zolotarev's lemma]]
*[[Character sum]]
*[[Law of quadratic reciprocity]]
*[[Quadratic residue code]]
 
==Notes==
{{reflist|colwidth=30em}}
 
==References==
 
The ''[[Disquisitiones Arithmeticae]]'' has been translated from Gauss's Ciceronian Latin into English and German. The German edition includes all of his papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes.
 
*{{citation
  | last1 = Gauss  | first1 = Carl Friedrich
  | last2 = Clarke | first2 = Arthur A. (translator into English)
  | title = Disquisitiones Arithemeticae |edition=Second corrected
  | publisher = [[Springer Science+Business Media|Springer]]
  | location = New York
  | year = 1986
  | isbn = 0-387-96254-9}}
*{{citation
  | last1 = Gauss | first1 = Carl Friedrich
  | last2 = Maser | first2 = H. (translator into German)
  | title = Untersuchungen über hohere Arithmetik |trans_title=Disquisitiones Arithemeticae & other papers on number theory |edition=second
  | publisher = Chelsea
  | location = New York
  | year = 1965
  | isbn = 0-8284-0191-8}}
*{{citation
  | last1 = Bach  | first1 = Eric
  | last2 = Shallit | first2 = Jeffrey
  | series = Algorithmic Number Theory |volume=I |title=Efficient Algorithms
  | publisher = [[The MIT Press]]
  | location = Cambridge
  | year = 1996
  | isbn = 0-262-02405-5}}
*{{citation
  | last1 = Crandall  | first1 = Richard
  | last2 = Pomerance  | first2 = Carl
  | title = Prime Numbers: A Computational Perspective
  | publisher = Springer
  | location = New York
  | year = 2001
  | isbn = 0-387-94777-9}}
*{{Citation
  | last = Davenport
  | first = Harold
  | title = Multiplicative Number Theory |edition=third
  | publisher = Springer
  | location = New York
  | year = 2000
  | isbn = 0-387-95097-4}}
*{{Citation
  |last=Garey |first= Michael R. |authorlink=Michael R. Garey |last2=Johnson |first2=David S. |author2-link=David S. Johnson
  | year = 1979
  | title = Computers and Intractability: A Guide to the Theory of NP-Completeness
  | publisher = W. H. Freeman
  | isbn = 0-7167-1045-5}} A7.1: AN1, pg.249.
*{{citation
  | last1 = Hardy  | first1 = G. H.
  | last2 = Wright | first2 = E. M.
  | title = An Introduction to the Theory of Numbers |edition=fifth
  | publisher = [[Oxford University Press]]
  | location = Oxford
  | year = 1980
  | isbn = 978-0-19-853171-5}}
*{{citation
  | last1 = Ireland  | first1 = Kenneth
  | last2 = Rosen  | first2 = Michael
  | title = A Classical Introduction to Modern Number Theory |edition=second
  | publisher = Springer
  | location = New York
  | year = 1990
  | isbn = 0-387-97329-X}}
*{{citation
  | last1 = Lemmermeyer  | first1 = Franz
  | title = Reciprocity Laws: from Euler to Eisenstein
  | publisher = Springer
  | location = Berlin
  | year = 2000
  | isbn = 3-540-66957-4}}
*{{Citation
  |first=Kenneth L. |last=Manders
  |last2=Adleman |first2=Leonard |author2-link=Leonard Adleman
  |title = ''NP''-Complete Decision Problems for Binary Quadratics
  |journal = Journal of Computer and System Sciences
  |volume=16 |issue=2 |year=1978
  |pages = 168&ndash;184
  |doi = 10.1016/0022-0000(78)90044-2
  |postscript = .}}
 
==External links==
*{{MathWorld|urlname=QuadraticResidue|title=Quadratic Residue}}
*{{PlanetMath|urlname=PolyaVinogradovInequality|title=Proof of Pólya&ndash;Vinogradov inequality}}
 
{{DEFAULTSORT:Quadratic Residue}}
[[Category:Modular arithmetic]]
[[Category:NP-complete problems]]
[[Category:Quadratic residue]]
 
[[ja:平方剰余]]
[[zh-classical:二次剩餘]]

Revision as of 20:57, 3 March 2014

Hi there. Mƴ namе is Demetra and Ӏ totally dig thаt title. Ӏn mʏ expert lifestyle ӏ am a journey agent. Hеr spouse doesn't like it Sveriges bästa casino tҺе waʏ she ɗoes ƅut what she truly likes performing ultimata casinosidorna tillsammans is playing dominoes and ѕhe would by no means givе it up. Yеars ago he moved tо Michigan ɑnd hе haѕ eνerything tҺat ɦe neeɗs therе. Go to my web site to find ߋut moгe: https://serpinjector.zendesk.com/entries/53722750-Gestalta-Villig-Online-Kasinon-Is-Essential-For-Your-Success-Read-This-To-Find-Out-Why

Review my web site - casinon