I was studying quadratic residue mod $n$, $n=p_1p_2\dots,p_k$ where $p_i$ are distinct primes such that $p_i\equiv 3\pmod4$ recently. Let $Q=\{x^2\equiv q\pmod n | gcd(q,n)=1\}$ be the set of quadratic residue mod $n$. In this case, the cardinality of $Q$ is $\frac{\phi(n)}{2^k}$. I was wondering if we drop the assumption that $gcd(q,n)=1$ and define $Q=\{x^2\equiv q\pmod n|q\in\mathbb{Z}_n-\{0\}\}$, the definition used in Wikipedia, then what will be the cardinality of $Q$? I tried finding the pattern by calculating $Q$ for some small values of $n$, but could not find any. I also used Wolfram|Aplha to find $Q$ for some larger values but there too I could not guess any relation. Any help in this direction or any suggestion for the materials or books to read on the topic will be highly appreciated.
2026-03-27 17:53:10.1774633990
Cardinality of set of quadratic residue of mod n.
127 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in NUMBER-THEORY
- Maximum number of guaranteed coins to get in a "30 coins in 3 boxes" puzzle
- Interesting number theoretical game
- Show that $(x,y,z)$ is a primitive Pythagorean triple then either $x$ or $y$ is divisible by $3$.
- About polynomial value being perfect power.
- Name of Theorem for Coloring of $\{1, \dots, n\}$
- Reciprocal-totient function, in term of the totient function?
- What is the smallest integer $N>2$, such that $x^5+y^5 = N$ has a rational solution?
- Integer from base 10 to base 2
- How do I show that any natural number of this expression is a natural linear combination?
- Counting the number of solutions of the congruence $x^k\equiv h$ (mod q)
Related Questions in QUADRATIC-RESIDUES
- Prove: $k^2 \equiv 1 \mod p \implies k \equiv \pm1 \mod p$
- Number of solution is twice $(x,y)$
- Prove $\sum\limits_{j=1}^{p-1} j\left(\frac{j}{p}\right) = 0 $ for an odd prime $p$ with $p\equiv 1\text{ mod } 4$
- Understanding quadratic reciprocity
- Show that there's a solution to $x^2 \equiv -1 \pmod {p^2}$
- Number of solutions for quadratic polynomials in $\mathbb{F}_p$
- The existence of a solution of a quadratic congruence modulo $p$
- How many quadratic residues of $\mathbb{F}_{p^n}$ are in the kernel of a morphism $\mathbb{F}_{p^n}^+\to \mathbb{F}_p^+$?
- A question about the Legendre symbol $\left(\frac{1+a}{p}\right)$
- How many $k$ satisfy the equation $(p \cdot k)^2 \equiv 0 \pmod{p^n}$ where $k < p^n$ and $p$ is prime
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
I think you should be able to solve this with the Chinese Remainder Theorem. Let's start with your first case where we require $\gcd=1$. If you think about it, the Chinese Remainder Theorem it says that $$ \left(\mathbb{Z}/n\mathbb{Z}\right)^\times\cong \prod_{i=1}^k\left(\mathbb{Z}/p_i\mathbb{Z}\right)^\times $$ Now a square in $\left(\mathbb{Z}/n\mathbb{Z}\right)^\times$ corresponds to picking a square in each $\left(\mathbb{Z}/p_i\mathbb{Z}\right)^\times$. There are $\frac{p_i-1}{2}$ such squares. So we see that the number of squares in $\left(\mathbb{Z}/n\mathbb{Z}\right)^\times$ will be given by $$ \prod_{i=1}^k\frac{p_i-1}{2}=\frac{\phi(n)}{2^k} $$ where the above equality comes from pulling out the $k$ factors of $2$ and using the fact that $\phi(p_i)=p_i-1$ and the fact that $\phi$ is a multiplicative function. This is what you said in your question, so we now see how it is derived.
Now you are interested in the non-zero square $\mathbb{Z}/n\mathbb{Z}$ (so we drop the gcd condition). Again the Chinese Remainder Theorem tells us that $$\mathbb{Z}/n\mathbb{Z}\cong\prod_{i=1}^k\mathbb{Z}/p_i\mathbb{Z} $$ Now we will have all the squares of the above, but we will have additional squares coming from if for a prime $p_i$ the corresponding modulus is $0$. Thus, we will have for each prime $p_i$ there will be $\frac{p_i+1}{2}$ squares. Thus, we will have that the number of squares is given by $$ \prod_{i=1}^k\frac{p_i+1}{2}=\frac{\sigma(n)}{2^k} $$ But you will need to subtract $1$ from the above formula to take away $0$. I guess this might be a little less satisfying of a formula since it isn't as closed of a form. Since we don't have that $p+1$ is a multiplicative function.
Edit: From the discussion below in the comments, we should thank Erick for pointing out how we can write the product with the $\sigma$ function. Furthermore, with isnet's question about dealing with prime powers the use of the Chinese Remainder Theorem should continue to work and solving the prime power case and then combining them together. However, it should be remarked that my above computation assumes that $n$ is odd (as $2$ is always a different case). Rather than reinventing the wheel, I found this short paper by Walter D. Stangl that is fairly readable called Counting Squares in $\mathbb{Z}_n$ as this paper should address the more general case for a general modulus $n$.