Quadratic residue modulo n
For integers a and n with and gcd(a,n)=1, a is a quadratic residue modulo n if the congruence ≡ a (mod n) has a solution. If no such x exists, a is a quadratic non-residue modulo n.
Michael Penn · YouTube · 4:44
This 150-second introductory number-theory clip defines quadratic residues and quadratic non-residues modulo a positive integer n under the assumption gcd(a,n)=1, then works a concrete example with . The lecturer corrects a brief verbal slip so the defining congruence is , notes that later theory will focus mainly on odd prime moduli, computes the squares of 1 through 6 modulo 7, observes a symmetric matching pattern among those results, and concludes that the quadratic residues modulo 7 are 1, 2, and 4. This clip teaches the definition of quadratic residue and quadratic non-residue modulo n under the condition gcd(a,n)=1, then works two explicit examples. First, for , the presenter squares the coprime residues and concludes that 1, 2, 4 are quadratic residues while 3, 5, 6 are non-residues. After erasing the example, he repeats the same strategy for the composite modulus , keeping only 1, 3, 5, 7 because they are relatively prime to 8. All four square to 1 modulo 8, so 1 is the only quadratic residue and 3, 5, 7 are non-residues. The segment ends by previewing proofs of further propositions in the next video.
Use the learning inspector for key ideas and moments, or open the reading tabs for the complete notes.
Generated from the video's visuals and explanation; not verbatim speech.
The clip opens with the formal definition written on the left side of the board: for an integer a and a positive modulus n with , a is called a quadratic residue modulo n exactly when the congruence is solvable; otherwise it is a quadratic non-residue.
A brief spoken slip says “a squared,” but the lecturer immediately corrects it to the intended unknown variable x, matching the board formula .
After stating the general definition, the lecturer adds that the upcoming theory will mostly concentrate on the important special case where n is an odd prime.
The right side of the board then introduces a concrete example with , chosen because 7 is an odd prime.
To determine the quadratic residues modulo 7, the lecturer directly computes the squares of the nonzero residue classes: , , , , , and , all modulo 7.
Looking at the vertical list, the lecturer points out a mirrored structure: the first and last entries both give 1, the second and fifth both give 4, and the third and fourth both give 2.
From these computations, the distinct residues that occur as squares modulo 7 are collected, yielding the quadratic residues modulo 7.
The clip opens with the completed definition already written on the left side of the board: for an integer a and a positive modulus n with gcd(a,n)=1, a is called a quadratic residue modulo n if the congruence x² ≡ a (mod n) is solvable; otherwise it is a quadratic non-residue. The middle column is devoted to the example , and the right column records the conclusion.
From the displayed square computations modulo 7, the distinct square values are 1, 2, and 4. Therefore the presenter states that these are the quadratic residues modulo 7. The remaining coprime classes, 3, 5, and 6, are then labeled quadratic non-residues modulo 7.
Having finished an example with an odd prime modulus, the presenter announces a second example using a composite number. He erases the middle and right portions of the board while leaving the definition untouched, signaling that the same conceptual framework will now be applied to a new modulus.
The new example is modulo 8. The presenter says he will use the same strategy: take all numbers relatively prime to 8, square them, and inspect the resulting residue classes. This makes the method explicit: first filter by coprimality, then compute squares, then classify the outcomes using the definition.
For , the positive residues less than 8 that are relatively prime to 8 are 1, 3, 5, and 7. The numbers 2, 4, and 6 are excluded because they share a factor with 8. This step directly uses the hypothesis gcd(a,n)=1 from the definition.
The presenter then computes the squares modulo 8: 1² ≡ 1, 3² = 9 ≡ 1, 5² = 25 ≡ 1, and 7² = 49 ≡ 1 (mod 8). All four coprime bases collapse to the same residue class, namely 1.
Because the only distinct square value obtained is 1, the conclusion written on the board is that 1 is the only quadratic residue modulo 8. By the complementary part of the definition, the remaining coprime classes 3, 5, and 7 are quadratic non-residues modulo 8.
The segment closes with a brief transition note: this video ends here, and the next one will prove several propositions about quadratic residues. No additional theorem statements are given within this clip.
For integers a and n with and gcd(a,n)=1, a is a quadratic residue modulo n if the congruence ≡ a (mod n) has a solution. If no such x exists, a is a quadratic non-residue modulo n.
The definition explicitly assumes gcd(a,n)=1, so a and n are coprime. This condition is part of the stated setup before deciding whether a is a quadratic residue.
Although the definition is given for general positive n, the lecturer says the subsequent results will mostly concern the case where n is an odd prime.
Taking , the lecturer computes the squares of 1 through 6 modulo 7 and obtains the residues 1, 4, 2, 2, 4, 1.
The six computed congruences display a folded symmetry: 1 pairs with 1, 4 pairs with 4, and 2 pairs with 2 when the list is read from the outside inward.
Collecting the distinct outputs from the example shows that the quadratic residues modulo 7 are exactly 1, 2, and 4.
The video defines a quadratic residue in a restricted setting: let a be an integer and n a positive integer with gcd(a,n)=1. Then a is a quadratic residue modulo n exactly when the congruence x² ≡ a (mod n) has a solution. The definition is shown on the left side of the board throughout the clip and is used as the basis for both worked examples.
Under the same hypotheses, the video defines the complementary case. If gcd(a,n)=1 but x² ≡ a (mod n) is not solvable, then a is called a quadratic non-residue modulo n. In the examples, this is applied by identifying the coprime residue classes that do not appear among the computed square values.
The worked examples use a direct computational procedure. First list the positive residues less than n that are relatively prime to n. Then square each representative and reduce modulo n. The distinct results are the quadratic residues; the remaining coprime classes are the quadratic non-residues. The presenter explicitly calls this the same strategy when moving from to .
For , the board shows the six coprime classes 1 through 6 and computes their squares modulo 7: 1²≡1, 2²≡4, 3²≡2, 4²≡2, 5²≡4, 6²≡1. The distinct square values are 1, 2, and 4, so those are the quadratic residues modulo 7. The leftover coprime classes 3, 5, and 6 are the quadratic non-residues modulo 7.
For , the presenter first keeps only the residues relatively prime to 8, namely 1, 3, 5, and 7, excluding 2, 4, and 6. He then computes 1²≡1, 3²=9≡1, 5²=25≡1, and 7²=49≡1 (mod 8). Since all square computations give 1, the only quadratic residue modulo 8 is 1, and the quadratic non-residues are 3, 5, and 7.
The definition on the board includes the hypothesis gcd(a,n)=1, and the example makes this operational. The presenter explicitly rejects 2, 4, and 6 because they are not relatively prime to 8. Thus the classification in this clip is not about every residue class modulo n, but only about those coprime to n.
The modulo 8 example illustrates that several different bases can produce the same residue class after squaring. The bases 1, 3, 5, and 7 are distinct, but all satisfy x² ≡ 1 (mod 8). The quadratic residues are determined by the set of distinct square values, not by counting how many bases lead to each value.
Explore conditions, steps and evidence. Supplementary explanations are labeled separately from content shown in the video.
The board writes `` in the definition.
The speaker says, "if a and n are integers".
a
An integer whose quadratic-residue status modulo n is being discussed.
The board writes `` and later uses `` and ``.
The speaker says, "n is in addition bigger than zero, so it's a natural number".
n
Positive modulus; in the example it is specialized to 7.
,\
The board writes ``.
The speaker says, "the gcd of a and n is one, so they're coprime".
Greatest common divisor of a and n; the definition requires it to equal 1.
Integer-valued function on pairs of integers
The board writes ``.
The speaker says, "if x squared congruent to a mod n is solvable".
x
Unknown integer whose square is tested for congruence to a modulo n.
Integers (implicit from the congruence equation)
The board repeatedly uses ` ... ` and ``.
The speaker reads examples such as "congruent to 1 mod 7".
Congruence relation modulo n.
Defined on integers
Left board definition reads: "Let a ∈ ℤ with and gcd(a,n)=1. Then a is said to be a quadratic residue modulo n if x² ≡ a (mod n) is solvable."
a
An integer in the definition of quadratic residue/non-residue; in the worked examples the specific values are the bases being squared or the residues being classified.
Integers, with the examples using positive residues less than the modulus.
Definition line includes "" and the congruence is written modulo n.
n
The modulus in the general definition of quadratic residue modulo n.
Positive integers.
Definition line includes "gcd(a,n)=1".
gcd(a,n)
Greatest common divisor of a and n; the definition requires it to equal 1.
Integer-valued function on pairs of integers.
Definition line includes "x² ≡ a (mod n) is solvable".
Congruence condition whose solvability determines whether a is a quadratic residue modulo n.
Congruence relation over integers modulo n.
Middle column heading reads "ex: ".
Modulus used in the first worked example.
Specific positive integer modulus.
After erasing the first example, the middle column heading is rewritten as "ex: ".
Modulus used in the second worked example.
Specific positive integer modulus.
Right column conclusion reads "So 1,2,4 are quadratic residues mod 7."
1,2,4
Quadratic residues modulo 7 identified from the listed squares.
Residue classes modulo 7.
Board text: "Definition: Let with and . Then a is said to be a quadratic residue modulo n if is solvable. Otherwise it is a quadratic non-residue."
Speaker states the same definition aloud, including the correction from "a squared" to "x squared".
For an integer a and a positive modulus n with gcd(a,n)=1, a is called a quadratic residue modulo n exactly when the congruence has a solution. If that congruence has no solution, a is called a quadratic non-residue modulo n.
a is an integer
solvability means there exists an integer x satisfying the congruence
Speaker says, "we'll mostly be interested when n is an odd prime."
Although the definition is stated for any positive modulus n coprime to a, the lecturer announces that the later theory will mainly concentrate on the case where n is an odd prime.
General definition allows any with
Subsequent emphasis is on odd prime n
Left board states: "Definition: Let a ∈ ℤ with and gcd(a,n)=1. Then a is said to be a quadratic residue modulo n if x² ≡ a (mod n) is solvable."
The speaker continues the definition by saying that otherwise it is a quadratic non-residue.
The video gives a definition for an integer a relative to a positive modulus n, under the explicit coprimality condition gcd(a,n)=1. It says a is a quadratic residue modulo n exactly when the congruence x² ≡ a (mod n) has a solution. The same setup also defines the complementary case: if that congruence is not solvable, then a is called a quadratic non-residue modulo n.
a ∈ ℤ
gcd(a,n)=1
Classification depends on whether x² ≡ a (mod n) is solvable
Left board includes: "Otherwise, it is a quadratic non-residue."
In both examples the speaker labels the leftover coprime residues as quadratic non-residues.
Within the same definition block, the video states the negative case: if a satisfies gcd(a,n)=1 but the congruence x² ≡ a (mod n) is not solvable, then a is a quadratic non-residue modulo n. The examples apply this by taking the coprime residues not appearing among the computed square values.
a ∈ ℤ
gcd(a,n)=1
x² ≡ a (mod n) is not solvable
Speaker says: "We're going to use the same strategy. So we're going to take all of the numbers that are relatively prime to 8 and square them and see what we get."
For he lists 1,3,5,7 and computes their squares modulo 8.
The worked examples use a direct computational method. First list the positive residues less than n that are relatively prime to n. Then square each one and reduce modulo n. The distinct results are the quadratic residues; the remaining coprime residues are the quadratic non-residues. This method is shown explicitly for and again for .
Use the definition with gcd(a,n)=1
Compute x² mod n for representatives x coprime to n
Collect distinct square values as residues
Middle column lists 1²≡1, 2²≡4, 3²≡2, 4²≡2, 5²≡4, 6²≡1 (mod 7).
Right column writes: "So 1,2,4 are quadratic residues mod 7."
For modulus 7, the quadratic residues among the coprime residues are 1, 2, and 4.
Consider residues relatively prime to 7
Use the definition of quadratic residue via solvability of x² ≡ a (mod 7)
For the listed residue classes modulo 7.
Speaker says: "whatever's left, so which is 3, 5, and 6, are quadratic non-residues mod 7."
Right column writes: "3,5,6 are quad non-residues mod 7."
For modulus 7, the quadratic non-residues among the coprime residues are 3, 5, and 6.
Residues 3,5,6 are coprime to 7
They do not appear among the square values 1,2,4 modulo 7
For the listed residue classes modulo 7.
Middle column lists 1²≡1, 3²≡1, 5²≡1, 7²≡1 (mod 8).
Right column writes: "1 is the only quadratic residue modulo 8."
For modulus 8, 1 is the only quadratic residue among the coprime residues.
Consider residues relatively prime to 8
Use the definition of quadratic residue via solvability of x² ≡ a (mod 8)
Among the coprime residue classes modulo 8.
Speaker says: "So we have 1 as a quadratic residue, that means 3, 5, and 7 are quadratic non-residues."
For modulus 8, the quadratic non-residues among the coprime residues are 3, 5, and 7.
Residues 3,5,7 are coprime to 8
They are not equal to the sole square value 1 modulo 8
For the listed residue classes modulo 8.
Speaker says, "what we're going to do is just square all of the numbers mod 7 and see what the outputs are."
Board lists ``, ``, ``, ``, ``, `` all `()`.
Square 1 and reduce modulo 7.
Direct computation.
Square 2 and reduce modulo 7.
Direct computation.
Square 3 to get 9, then reduce 9 modulo 7.
Direct computation and reduction modulo 7.
Square 4 to get 16, then reduce 16 modulo 7.
Direct computation and reduction modulo 7.
Square 5 to get 25, then reduce 25 modulo 7.
Direct computation and reduction modulo 7.
Square 6 to get 36, then reduce 36 modulo 7.
Direct computation and reduction modulo 7.
The residues obtained by squaring 1 through 6 modulo 7 are 1, 4, 2, 2, 4, 1.
Speaker says, "if we fold this list over this line right here they match. So two matches with two, four with four, and one with one."
The six displayed congruences are arranged vertically, and the speaker gestures toward the middle of the list.
Compare the first and last entries of the list.
Both reduce to 1 modulo 7.
Compare the second and fifth entries.
Both reduce to 4 modulo 7.
Compare the third and fourth entries.
Both reduce to 2 modulo 7.
The list of squares modulo 7 has a mirrored structure: matching pairs give the same residue.
Middle column shows the six square computations modulo 7.
Right column states the resulting residue and non-residue sets.
Square the first coprime representative and reduce modulo 7.
Direct modular arithmetic.
Square the next representative and reduce modulo 7.
Direct modular arithmetic.
Compute 9 and reduce it modulo 7.
Reduction of an integer modulo 7.
Compute 16 and reduce it modulo 7.
Reduction of an integer modulo 7.
Compute 25 and reduce it modulo 7.
Reduction of an integer modulo 7.
Compute 36 and reduce it modulo 7.
Reduction of an integer modulo 7.
Collect the distinct square values obtained modulo 7.
By the definition, these are the quadratic residues modulo 7.
Take the remaining coprime residues not appearing in the square-value set.
By the definition, these are the quadratic non-residues modulo 7.
Modulo 7, the quadratic residues are 1, 2, 4 and the quadratic non-residues are 3, 5, 6.
Middle column lists 1,3,5,7 and then their squares modulo 8.
Speaker explains which numbers are relatively prime to 8 and then computes the squares.
Right column concludes that 1 is the only quadratic residue modulo 8.
Identify the positive residues less than 8 that are relatively prime to 8.
Direct check of coprimality with 8.
Square the first coprime representative.
Direct modular arithmetic.
Compute 9 and reduce modulo 8.
Reduction of an integer modulo 8.
Compute 25 and reduce modulo 8.
Reduction of an integer modulo 8.
Compute 49 and reduce modulo 8.
Reduction of an integer modulo 8.
Collect the distinct square values obtained modulo 8.
By the definition, these are the quadratic residues modulo 8.
Take the remaining coprime residues not appearing among the square values.
By the definition, these are the quadratic non-residues modulo 8.
Modulo 8, the only quadratic residue among the coprime residues is 1, and the non-residues are 3, 5, 7.
Board writes "ex: " and then the six square congruences.
Speaker says, "So let's take n equals 7" and proceeds to square all numbers mod 7.
Determine which residues arise as squares modulo 7 and identify the quadratic residues among them.
Consider the integers 1,2,3,4,5,6 modulo 7
Compute for these x-values and read off the quadratic residues.
Compute the square of 1 modulo 7.
Direct calculation.
Compute the square of 2 modulo 7.
Direct calculation.
Compute the square of 3 and reduce.
Direct calculation.
Compute the square of 4 and reduce.
Direct calculation.
Compute the square of 5 and reduce.
Direct calculation.
Compute the square of 6 and reduce.
Direct calculation.
Collect the distinct outputs from the six computations.
These are exactly the residues represented by some square modulo 7.
The quadratic residues modulo 7 are 1, 2, and 4.
Each listed residue appears among the computed squares modulo 7, and no other nonzero residue appears in the list.
Middle column heading reads "ex: " with six square congruences.
Right column states the residue and non-residue conclusions.
Classify the quadratic residues and non-residues modulo 7 using the definition.
Coprime residues to consider: 1,2,3,4,5,6
Computed squares modulo 7 are shown on the board
Determine which residue classes modulo 7 are quadratic residues and which are quadratic non-residues.
Start with the first representative and reduce its square.
Direct computation.
Continue through the representatives.
Direct computation.
Reduce 9 modulo 7.
Direct computation.
Reduce 16 modulo 7.
Direct computation.
Reduce 25 modulo 7.
Direct computation.
Reduce 36 modulo 7.
Direct computation.
Read off the distinct square values as the residues.
Definition of quadratic residue via solvability of x² ≡ a (mod n).
The remaining coprime classes are the non-residues.
Definition of quadratic non-residue as the unsolvable case.
Quadratic residues mod 7: 1, 2, 4. Quadratic non-residues mod 7: 3, 5, 6.
The listed square values modulo 7 are exactly 1, 2, and 4, and the remaining coprime classes are 3, 5, and 6.
Middle column heading reads "ex: " and lists 1,3,5,7 with their squares modulo 8.
Speaker says this is a composite-number example and uses the same strategy.
Right column states: "1 is the only quadratic residue modulo 8."
Classify the quadratic residues and non-residues modulo 8 using the same strategy as before.
Only residues relatively prime to 8 are considered: 1,3,5,7
Squares modulo 8 are computed on the board
Determine which coprime residue classes modulo 8 are quadratic residues and which are quadratic non-residues.
Select the positive residues less than 8 that are relatively prime to 8.
The definition requires gcd(a,n)=1, and the speaker explicitly excludes 2,4,6.
Square the first selected representative.
Direct computation.
Reduce 9 modulo 8.
Direct computation.
Reduce 25 modulo 8.
Direct computation.
Reduce 49 modulo 8.
Direct computation.
All square computations give the same residue class.
Distinct square values determine the quadratic residues.
The other coprime classes are therefore non-residues.
Definition of quadratic non-residue as the unsolvable case.
The only quadratic residue modulo 8 is 1; the quadratic non-residues are 3, 5, 7.
Each coprime base 1,3,5,7 squares to 1 modulo 8, so no other coprime class appears as a square value.
A blackboard is split into a left definition panel and a right example panel.
The lecturer points to the definition, then writes the example heading and the six congruences on the right side.
Left panel with the formal definition
Right panel headed "ex: "
Vertical list of six congruences modulo 7
Right panel begins blank
Then `ex: ` is written
Then the six square congruences are added one by one
Finally the speaker gestures at the symmetry among the rows
Left-panel definition remains visible throughout
Modulus 7 remains fixed during the example
The visual layout separates the general definition from a concrete computational example, making the transition from abstract criterion to explicit residue testing easy to follow.
The blackboard is divided into three vertical sections: definition on the left, worked computations in the middle, and conclusions on the right.
Left definition panel
Middle example-computation panel
Right conclusion panel
Presenter writing with chalk
The middle and right panels are first filled with the example.
Around 42 seconds the presenter erases the middle and right panels while leaving the left definition intact.
The middle and right panels are then refilled with the example.
The left definition remains visible throughout the clip.
The mathematical task stays the same: classify quadratic residues and non-residues for a chosen modulus.
The visual layout separates theory from computation and conclusion, making the examples read as applications of the fixed definition on the left.
The presenter wipes away the previous example content from the middle and right columns before rewriting a new heading.
Chalkboard eraser/hand motion
Old computations
New blank middle/right space
The computations and conclusions disappear.
A new heading for is written in the middle column.
The definition on the left does not change.
The method of squaring coprime representatives is carried over to the new modulus.
This visual reset marks a shift from an odd prime modulus to a composite modulus while keeping the same definitional framework.
Speaker says, "if a squared is congruent sorry if x squared congruent to a mod n is solvable."
One might think the defining equation is because the speaker initially misspeaks.
The corrected and board-written condition is : x is the unknown being solved for, while a is the integer whose residue status is under discussion.
For the speaker explicitly says: "2 is not relatively prime, so we can't use that. 4 is not, so we can't use that. 6 is not," and only keeps 1,3,5,7.
One might try to classify every residue modulo n as a quadratic residue or non-residue without checking gcd(a,n)=1.
The video's definition applies only when gcd(a,n)=1. In the example, 2, 4, and 6 are excluded before squaring because they are not relatively prime to 8.
For , four different bases 1,3,5,7 all produce the same square value 1 modulo 8.
The speaker concludes from the repeated outputs that 1 is the only quadratic residue modulo 8.
One might expect each coprime base to produce a different quadratic residue.
The examples show that several different bases can square to the same residue class. What matters is the set of distinct square values modulo n, not the number of bases used to obtain them.
Left panel gives the general definition; right panel applies it with .
Speaker moves from the definition directly into "let's look at an example".
The example with applies the general definition by explicitly computing which residues occur as squares modulo 7.
After stating the general definition, the speaker says future results will mostly concern odd prime n.
Odd prime moduli are a special case of the general definition that the lecturer highlights for later theory.
Speaker notes the folded matching pattern before listing the residues.
The repeated residues 1,4,2 appear in symmetric positions in the six-row list.
The observed mirrored structure helps justify why only three distinct residues, 1, 2, and 4, are collected as the quadratic residues modulo 7.
The left definition introduces solvability of x² ≡ a (mod n).
The speaker says for : "We're going to use the same strategy" and then squares the coprime representatives.
The computational method is an application of the definition: by squaring candidate bases and reducing modulo n, one directly tests which coprime residues occur as square values.
The definition states the residue case and then says "Otherwise, it is a quadratic non-residue."
Both examples split the coprime classes into square values and leftover classes.
Quadratic non-residue is defined as the complementary case to quadratic residue under the same coprimality hypothesis.
Speaker says: "we've looked at an example where we have an odd prime, and so now I'm going to do one more example where we have a composite number just for good measure."
Both examples use the same three-step pattern: list coprime classes, square them, classify the outcomes.
The two examples contrast an odd prime modulus with a composite modulus while using the same definition-driven procedure.
The square computations lead directly to the stated residue and non-residue sets.
The claim about residues modulo 7 depends on the method of computing distinct square values from coprime representatives.
The square computations lead directly to the statement that 1 is the only quadratic residue modulo 8.
The uniqueness claim for modulo 8 follows from the explicit computation that all coprime bases square to 1.
Definition written on the left side of the board.
Speaker explains the definition verbally.
Board includes `` in the hypothesis.
Speaker says, "so they're coprime".
Six explicit congruences modulo 7 are written on the board.
Speaker says he will square all numbers mod 7 and see the outputs.
Speaker says the list can be folded and the entries match.
Vertical arrangement of the six congruences makes the pairing visible.
Speaker says later results will mostly be about odd prime n.
Left board definition is visible throughout.
Left board includes the "Otherwise" clause.
Speaker excludes 2,4,6 for because they are not relatively prime to 8.
Right column states the conclusion.
Right column states the non-residue conclusion.
Right column states that 1 is the only quadratic residue modulo 8.
Speaker says 3, 5, and 7 are quadratic non-residues.
Covered · General definition of quadratic residue and quadratic non-residue modulo n, including the coprimality hypothesis and the spoken self-correction from to .
Covered · Lecturer states that later results will mostly focus on the case where n is an odd prime.
Covered · Worked example with : compute the squares of 1 through 6 modulo 7 and record the resulting residues.
Covered · Observation of the mirrored or folded structure among the six displayed congruences.
Covered · Conclusion of the example: list the quadratic residues modulo 7 as 1, 2, and 4.
Covered · Opening segment completes the example and states the residue/non-residue classification.
Covered · Speaker transitions verbally from an odd prime example to a composite example and erases the middle/right board content.
Covered · Full worked example: identify coprime residues, square them, conclude unique residue 1 and non-residues 3,5,7.
Covered · Closing remarks announce that the next video will prove propositions about quadratic residues; no new mathematical content is introduced.
Reviewed subject paths