PYQ Vault

CDS Mathematics · Number System

Perfect Squares, Cubes & Difference of Squares

Recognising and building perfect squares — which last digits are possible, how far the nearest square is, and above all how to turn a difference of squares into a factor-pair count with a parity constraint.

Why this matters

Fourteen PYQs, and the difference-of-squares factorisation carries four of them on its own. The rest are recall (a square never ends in 2, 3, 7 or 8) or a nearest-square computation. One HARD question needs the completing-the-square trick, which turns an apparently open search into a two-case factor problem.

Concept 1 of 6: The last digit of a perfect square

Square each digit 0 to 9 and look at the last digit of the result: only six values ever appear. So any number ending in 2, 3, 7 or 8 is instantly disqualified as a square, with no arithmetic at all.

Definition

A perfect square can end only in 0,1,4,5,60, 1, 4, 5, 6 or 99.

  • Ending in 2,3,72, 3, 7 or 88 is impossible — this is a complete disqualifier.
  • The converse fails: ending in 4 does not make a number a square (14 does not).
  • A square's number of divisors is odd, and an odd square is ≡1(mod8)\equiv 1 \pmod 8.
Unit digit of nUnit digit of n squared
00
1 or 91
2 or 84
3 or 79
4 or 66
55
So the possible endings are exactly 0, 1, 4, 5, 6, 9 — and 2, 3, 7, 8 never occur.
Six reachable endings out of ten. The four unreachable ones are the examinable content.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

CDS · 2017 · CDS (II) 2017 — Elementary Mathematics · Q17Moderate

Example 1 · Number System · Perfect Squares, Cubes and Difference of Squares

Consider the following numbers : 1. 2222 2. 11664 3. 343343 4. 220347 Which of the above are not perfect squares ?

The last-digit test only rules out, never rules in

Of 2222, 11664, 343343 and 220347, the endings 2, 3 and 7 eliminate three immediately — but the survivor 11664 still has to be checked, and it happens to be 1082108^{2}. Treat the test as a filter that saves time, not as a proof of squareness.

Concept 2 of 6: The nearest perfect square above or below

To find how much to add or subtract to reach a square, locate the two consecutive squares straddling the number. Estimate the root, square the integers either side, and take the difference — two multiplications settle it.

Definition

Given NN, find the integer kk with k2≤N<(k+1)2k^{2} \le N < (k+1)^{2}. Then:

  • the least amount to subtract to reach a square is N−k2N-k^{2};
  • the least amount to add is (k+1)2−N(k+1)^{2}-N.

The same method works for higher powers — for a fourth power, bracket NN between m4m^{4} and (m+1)4(m+1)^{4}. Useful landmarks: 302=90030^2=900, 402=160040^2=1600, 702=490070^2=4900, 902=810090^2=8100, 1002=10000100^2=10000.

Distance to the neighbouring squares

k2≤N<(k+1)2:subtract N−k2,add (k+1)2−Nk^{2}\le N<(k+1)^{2}: \quad \text{subtract } N-k^{2}, \quad \text{add } (k+1)^{2}-N

Worked example

What is the least number that must be added to 5000 to make it a perfect square?
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

CDS · 2022 · CDS (I) 2022 — Elementary Mathematics · Q20Easy

Example 2 · Number System · Perfect Squares, Cubes and Difference of Squares

What is the smallest natural number from the following which must be subtracted from 9410 to make the remaining number a perfect square?

The number itself may not be a square even when it looks round

The smallest four-digit number is 1000, and it is tempting to answer 1000 for "smallest four-digit perfect square". But 1000 is not a square: 312=96131^2=961 has three digits and 322=102432^2=1024 has four, so the answer is 1024. Bracket with actual squares rather than trusting the round number.

Concept 3 of 6: Difference of squares and the parity constraint on factor pairs

m2−n2=(m−n)(m+n)m^{2}-n^{2} = (m-n)(m+n), so asking which numbers are a difference of squares is asking how to split a number into two factors. The catch is that the two factors must have the same parity, because their sum 2m2m is even — and that constraint is what makes the count come out small.

Definition

Set m2−n2=Nm^{2}-n^{2}=N, so (m−n)(m+n)=N(m-n)(m+n)=N. Write N=uvN = uv with u<vu<v; then

m=u+v2,n=v−u2,m=\frac{u+v}{2}, \qquad n=\frac{v-u}{2},
which are integers only if uu and vv have the same parity.

  • NN odd: every factor pair is odd-odd, so all pairs work.
  • N≡0(mod4)N \equiv 0 \pmod 4: only the even-even pairs work.
  • N≡2(mod4)N \equiv 2 \pmod 4: no pairs work, so such an NN is never a difference of squares.

The same setup solves n2+c=m2n^{2}+c = m^{2}, which rearranges to (m−n)(m+n)=c(m-n)(m+n)=c.

Difference of squares

m2−n2=(m−n)(m+n)m^{2}-n^{2}=(m-n)(m+n)

Worked example

How many pairs of natural numbers have squares differing by 45?
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

CDS · 2019 · CDS (I) 2019 — Elementary Mathematics · Q90Moderate

Example 3 · Number System · Perfect Squares, Cubes and Difference of Squares

How many pairs of natural numbers are there such that the difference of their squares is 35 ?

Mixed-parity factor pairs must be discarded

For N=72N=72 the pair (8,9)(8,9) multiplies correctly but gives m=8.5m=8.5 — not an integer. Only (2,36)(2,36), (4,18)(4,18) and (6,12)(6,12) survive, so the answer is 3. Counting all factor pairs rather than the same-parity ones is the standard error and inflates every answer in this concept.

A prime target forces a unique pair

If NN is prime the only factorisation is 1×N1\times N, so m=N+12m=\frac{N+1}{2} and n=N−12n=\frac{N-1}{2} uniquely. For N=199N=199 that is m=100m=100, n=99n=99, giving mn=9900mn = 9900 — no searching needed.

Concept 4 of 6: Completing the square to force a factorisation

"For which nn is this quadratic a perfect square?" looks like an open search. Completing the square turns it into a difference of two squares equal to a constant, and a constant has only finitely many factorisations — so the search becomes a short list.

Definition

To solve n2+bn+c=k2n^{2}+bn+c = k^{2}:

  • complete the square on the left, giving (n+b2)2+(c−b24)=k2\left(n+\tfrac b2\right)^{2} + \left(c - \tfrac{b^{2}}{4}\right) = k^{2};
  • if bb is odd, multiply through by 4 first to keep everything integral: 4n2+4bn+4c=(2n+b)2+(4c−b2)4n^{2}+4bn+4c = (2n+b)^{2}+\left(4c-b^{2}\right);
  • rearrange to k2−(⋯ )2=constantk^{2}-(\cdots)^{2} = \text{constant} and factor as a difference of squares;
  • enumerate the same-parity factor pairs of that constant and solve each.

Reduce to a constant difference of squares

n2+bn+c=k2  ⟹  (2k)2−(2n+b)2=4c−b2n^{2}+bn+c=k^{2} \;\Longrightarrow\; (2k)^{2}-(2n+b)^{2}=4c-b^{2}

Worked example

For how many integers nn is n2+8n+20n^{2}+8n+20 a perfect square?
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

CDS · 2019 · CDS (I) 2019 — Elementary Mathematics · Q96Hard

Example 4 · Number System · Perfect Squares, Cubes and Difference of Squares

What is the sum of all integer values of nn for which n2+19n+92n^2 + 19n + 92 is a perfect square ?

An odd middle coefficient needs the factor of 4

For n2+19n+92n^{2}+19n+92, completing the square directly gives halves. Multiply by 4 first: 4(n2+19n+92)=(2n+19)2+74(n^2+19n+92) = (2n+19)^{2}+7, so (2k)2−(2n+19)2=7(2k)^{2}-(2n+19)^{2}=7. Since 7 is prime the factors are ±1\pm1 and ±7\pm7, giving 2n+19=±32n+19=\pm3 and hence n=−8n=-8 or n=−11n=-11, summing to −19-19. Skipping the multiplication loses both solutions.

Concept 5 of 6: Expressions that are always perfect squares

A few standard expressions are squares for every value of the variable, and the examinable content is the closed form. The trick in each case is to spot the right substitution — usually the symmetric middle quantity.

Definition

Two identities CDS uses directly:

  • Four consecutive integers plus one. Put m=n2+3nm = n^{2}+3n; then

n(n+1)(n+2)(n+3)+1=m(m+2)+1=(m+1)2=(n2+3n+1)2.n(n+1)(n+2)(n+3)+1 = m(m+2)+1 = (m+1)^{2} = \left(n^{2}+3n+1\right)^{2}.

  • Consecutive pair with their product. If a=na=n, b=n+1b=n+1 and c=abc=ab, then

a2+b2+c2=(n2+n+1)2.a^{2}+b^{2}+c^{2}=\left(n^{2}+n+1\right)^{2}.
In both cases the result is odd, because a product of consecutive integers is even and the square of an odd number follows.

Four consecutive integers plus one

n(n+1)(n+2)(n+3)+1=(n2+3n+1)2n(n+1)(n+2)(n+3)+1=\left(n^{2}+3n+1\right)^{2}

Worked example

Show that n(n+1)(n+2)(n+3)+1n(n+1)(n+2)(n+3)+1 is always a perfect square, and evaluate it at n=2n=2.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

CDS · 2024 · CDS (II) 2024 — Elementary Mathematics · Q79Moderate

Example 5 · Number System · Perfect Squares, Cubes and Difference of Squares

Consider the following statements in respect of p=n(n+1)(n+2)(n+3)+1p = n(n+1)(n+2)(n+3) + 1, where nn is a natural number : I. pp is always odd II. pp is a perfect square Which of the statements given above is/are correct ?

Pair the OUTER factors, not adjacent ones

The identity works because n(n+3)n(n+3) and (n+1)(n+2)(n+1)(n+2) differ by exactly 2. Pairing n(n+1)n(n+1) with (n+2)(n+3)(n+2)(n+3) instead gives two quadratics differing by 4n+64n+6, and the substitution collapses. Always multiply the first by the last.

Concept 6 of 6: Cubes, fourth powers and taxicab numbers

Cubes come up in two shapes: recognising a small cube to solve mn=Nm^{n}=N, and the famous 1729, the smallest number expressible as a sum of two positive cubes in two different ways. Both are recall plus one line of arithmetic.

Definition

Cubes worth knowing on sight: 23=82^3=8, 33=273^3=27, 43=644^3=64, 53=1255^3=125, 63=2166^3=216, 73=3437^3=343, 93=7299^3=729, 103=100010^3=1000, 113=133111^3=1331, 123=172812^3=1728.

  • To solve mn=Nm^{n}=N, factorise NN into a single prime power; 1331=1131331 = 11^{3} gives m=11, n=3m=11,\ n=3.
  • 1729=13+123=93+1031729 = 1^{3}+12^{3} = 9^{3}+10^{3} — two ways, and the only number below 2000 with that property.
  • For a mixed condition (a cube now, a square later) the small cases are few enough to list.

Taxicab identity

1729=13+123=93+1031729 = 1^{3}+12^{3} = 9^{3}+10^{3}

Worked example

Verify that 1729 is a sum of two positive cubes in two different ways.
Practice this conceptself-check · 4 quick reps

The same idea in a real exam question:

CDS · 2016 · CDS (II) 2016 — Elementary Mathematics · Q22Moderate

Example 6 · Number System · Perfect Squares, Cubes and Difference of Squares

Which one of the following is correct in respect of the number 1729 ?

m to the n has a trivial solution that the question does not intend

mn=1331m^{n}=1331 is satisfied by m=1331, n=1m=1331,\ n=1 as well as by m=11, n=3m=11,\ n=3, and the trivial reading gives 13300=11330^{0}=1 — which appears in the option list. The stem's intent is the genuine power, so read any restriction such as "different from 1" carefully, and prefer the non-trivial factorisation when both are admissible.

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (5)

Reference tables (1)

The last digit of a perfect square6 rows
Unit digit of nUnit digit of n squared
00
1 or 91
2 or 84
3 or 79
4 or 66
55
So the possible endings are exactly 0, 1, 4, 5, 6, 9 — and 2, 3, 7, 8 never occur.
Six reachable endings out of ten. The four unreachable ones are the examinable content.

Watch out for (7)

Test yourself on Number System

20 past CDS questions from this chapter, timed at 24 minutes and marked the way the exam marks it. You see your score and every answer the moment you finish. Free to start.

Related notes