VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

Additional Mathematics | How to Maximise a Quadratic When Only Whole-Number Inputs Are Allowed

A quadratic may have its greatest real-valued output at a fractional input, even though a practical question allows only whole numbers. Find the parabola’s continuous vertex first, then compare the permitted integers nearest to it. If the vertex lies exactly halfway between two consecutive admissible integers, both may give the same best result.

For example, let f(n) = −2n² + 14n + 5, where n must be a whole number from 0 to 7. The continuous vertex is at n = 7/2, where f = 59/2. But n = 7/2 is not allowed. The nearest integers are 3 and 4, and both produce f = 29, the actual maximum over the integer domain. This guide explains why blindly rounding a calculus answer can fail, how to check ties and boundary constraints, and how first differences offer an efficient second method.

A real-number maximum is not automatically an integer maximum

A calculus or completing-the-square method usually finds the maximum of a quadratic over real inputs. The input giving that answer can be fractional.

But some quantities are counted in whole units: numbers of items, class groups, complete days or integer steps. In these situations the domain may be a set of integers rather than every real number in an interval.

The maximum over that discrete set cannot occur at a forbidden fractional input, even if the continuous graph reaches its vertex there.

A correct solution therefore distinguishes the continuous optimisation from the actual constrained question. This distinction matters more than whether differentiation or completing the square was used to find the vertex.

Read the permitted set of whole numbers

Suppose n must satisfy n ∈ {0,1,2,3,4,5,6,7}. The permitted values are discrete and finite.

A number such as 3.5 lies inside the real interval [0,7] but is not a member of this integer set. Writing 0 ≤ n ≤ 7 alone may hide that extra counting restriction.

When a question says n is a positive integer, zero may also be excluded. If it says n is a non-negative integer, zero is allowed.

Before solving, write the full domain in words or mathematical notation. It prevents a student from reporting a physically impossible number of people, boxes or completed sessions simply because a continuous formula produced that value.

The worked parabola opens downward

Take f(n) = −2n² + 14n + 5. Its leading coefficient is −2, which is negative.

Therefore the graph is a downward-opening parabola. The largest real output occurs at its vertex, and outputs decrease as we move away from that vertex.

The vertex’s input coordinate is h = −b/(2a), where a = −2 and b = 14.

Substitute: h = −14/[2(−2)] = 14/4 = 7/2. This fractional value is the continuous maximiser, not automatically an admissible whole-number solution.

Complete the square to see the same vertex

Rewrite f(n) = −2n² + 14n + 5. Factor −2 from the quadratic terms: −2(n² − 7n) + 5.

Complete the square: n² − 7n = (n − 7/2)² − 49/4. Thus f(n) = −2(n − 7/2)² + 49/2 + 5.

Combine the constants to obtain f(n) = 59/2 − 2(n − 7/2)².

The square term is always non-negative, so the largest continuous output is 59/2 at n = 7/2. Among integers, the best value occurs when the squared distance |n − 7/2| is as small as possible.

The two nearest integers must both be considered

The vertex 7/2 lies exactly halfway between the integers 3 and 4.

Their distances from the vertex are equal: |3 − 7/2| = 1/2 and |4 − 7/2| = 1/2. Therefore the completed-square formula gives the same function value at both.

There is no mathematical reason to round 3.5 upward rather than downward and discard one of the candidates. For a downward-opening quadratic, equal distance from the axis of symmetry means equal output.

A complete integer maximum answer lists both integer inputs if both are allowed. If a question asks only for the numerical maximum output, one value is enough, but a request for all optimal inputs needs both.

Calculate the actual integer maximum

Substitute n = 3 into f: f(3) = −2(9) + 14(3) + 5 = −18 + 42 + 5 = 29.

Substitute n = 4: f(4) = −2(16) + 14(4) + 5 = −32 + 56 + 5 = 29.

Both inputs belong to the allowed integer set 0 through 7. Thus the maximum attainable output is 29, achieved at n = 3 and n = 4.

The continuous maximum 59/2 is 29.5, only half a unit higher, but is unattainable because the required input is not an integer.

Why every other integer must be worse

The completed-square expression is f(n) = 59/2 − 2(n − 7/2)².

For n = 3 or 4, the squared distance is 1/4. Every other integer differs from 7/2 by at least 3/2, whose square is 9/4.

Because the square is multiplied by negative two, a larger distance creates a strictly smaller function output. Therefore no other integer can tie with 3 or 4.

This proves the maximum over all integer inputs, not just those in the example’s finite range, and therefore certainly over the restricted set 0 through 7. The argument is more rigorous than testing a few nearby numbers without explaining why distant values can be ignored.

A short value table provides an independent check

For n = 0,1,2,3,4,5,6,7, the outputs are 5,17,25,29,29,25,17,5 respectively.

The values increase toward the vertex and then decrease symmetrically after it. The pair of equal maxima is visible at n = 3 and 4.

This table confirms the exact algebra and may help parents understand the optimisation. But for a larger domain such as all integers from 0 to 10,000, listing every output would be inefficient.

Completing the square or using the derivative and the nearest admissible values gives a scalable method that does not depend on exhaustive enumeration.

Differentiate as a second solution

Treat n temporarily as a real variable and differentiate f(n) = −2n² + 14n + 5.

The derivative is f′(n) = −4n + 14. Set it to zero to obtain n = 14/4 = 7/2.

The second derivative is f″(n) = −4 < 0, so the real-valued stationary point is a maximum. The function increases before 7/2 and decreases after it.

Because only integers are permitted, check the nearest allowed integers 3 and 4. Differentiation identifies where to search; discrete comparison supplies the actual answer.

The general rule for a downward quadratic

Let f(x) = ax² + bx + c with a < 0. Complete the square as f(x) = a(x − h)² + k, where h = −b/(2a) is the vertex input.

The coefficient a is negative, so maximising f is equivalent to minimising (x − h)². Among a discrete permitted set, choose the input or inputs closest to h.

If every integer is allowed, the candidates are the floor and ceiling of h. If h itself is an integer, it is the unique closest integer. If h lies exactly halfway between two consecutive integers, both tie.

If the permitted set has other restrictions, such as only even integers or a bounded range, choose the closest values in that actual set rather than automatically using ordinary floor and ceiling.

A non-halfway vertex gives a unique integer maximum

Consider g(n) = −(n − 17/5)² + 10 for non-negative integer n.

The continuous vertex is h = 17/5 = 3.4. The nearest integers are 3 and 4.

Their squared distances are (3 − 3.4)² = 0.16 and (4 − 3.4)² = 0.36. Therefore g(3) = 9.84 and g(4) = 9.64.

The actual integer maximum is 9.84 at n = 3, and there is no tie. A rule that always rounds halves upward is not the important principle; comparison by distance from the vertex is.

A vertex exactly at an integer needs only one candidate

Take h(n) = −3(n − 5)² + 40 for integer n between 0 and 10.

The real vertex occurs at n = 5, which is itself an allowed integer. Then h(5) = 40.

Every other integer has positive squared distance from 5, so its output is strictly below 40. The maximum is unique.

There is no reason to check 4 and 6 as competing maxima after this exact proof, although evaluating them may be a useful numerical check. The discrete constraint changes nothing when the continuous maximiser already belongs to the permitted domain.

A boundary may replace both neighbouring candidates

Suppose f(n) = −(n − 8)² + 50 but only n ∈ {0,1,2,3,4,5} is allowed.

The continuous vertex is at n = 8, outside the permitted interval. The function is still increasing throughout the allowed domain because every permitted n is below 8.

Therefore the maximum over the allowed set occurs at the right endpoint n = 5, not at the unavailable vertex or at integers 7 and 8.

The output is f(5) = −9 + 50 = 41. This shows why domain endpoints must be part of the reasoning whenever the continuous vertex lies outside the allowed range.

An integer constraint may use only even values

Suppose n represents pairs of items and must be even: n ∈ {0,2,4,6,8}. Let f(n) = −(n − 5)² + 30.

The real vertex is at 5. But 5 is not an allowed even integer. The closest permitted inputs are 4 and 6, both one unit away.

Therefore f(4) = f(6) = 29, and both are optimal in the constrained set.

The ordinary nearest-integer rule would have selected the forbidden input 5. This is why the proper statement is “choose the nearest admissible inputs,” not “always round the continuous answer to a whole number.”

A minimum problem reverses the curvature decision

When a > 0, the quadratic opens upward and its vertex is a minimum over real inputs.

If a question asks for the minimum on integers, the closest permitted integer to the vertex gives the minimum, with a possible tie. The same distance argument applies but with positive curvature.

For instance, f(n) = 2(n − 7/2)² + 5, with integer n, is smallest at n = 3 and n = 4. Both give 2(1/4)+5 = 11/2.

But if the question asks for the maximum of an upward quadratic over a finite interval, the vertex is not the maximum. Compare the allowed endpoints instead. Always identify both the requested extremum and the sign of the leading coefficient.

For a positive quadratic, the maximum may be at an endpoint

Let f(n) = n² − 4n + 1 for integer 0 ≤ n ≤ 5. Since the leading coefficient is positive, the graph opens upward.

Its vertex n = 2 gives the minimum, not the maximum. Over the finite interval, an upward-opening quadratic reaches its largest value at one or both endpoints.

Calculate f(0) = 1 and f(5) = 25 − 20 + 1 = 6. Thus the maximum over the permitted integers is 6 at n = 5.

This example catches a common error: students who solve f′(n) = 0 and report the stationary value without checking whether the question wants a maximum or minimum and whether endpoints compete.

First differences provide a method without calculus

For a quadratic f(n) = an² + bn + c, compare neighbouring outputs directly.

Calculate f(n+1) − f(n) = a[(n+1)² − n²] + b[(n+1) − n]. The constant cancels.

Simplify (n+1)² − n² = 2n+1, giving Δf(n) = a(2n+1)+b.

The sign of this difference tells us whether moving from integer n to integer n+1 increases, decreases or leaves the output unchanged. This is especially useful in integer optimisation when students have not yet studied differentiation or want an exact independent check.

Use first differences on the opening example

For f(n) = −2n² + 14n + 5, the first difference is Δf(n) = −2(2n+1)+14 = 12−4n.

For n = 0,1,2 the difference is positive, so the outputs increase. At n = 3, Δf(3) = 12−12 = 0, so f(4) = f(3).

For n ≥ 4, the difference is negative, so each subsequent integer output decreases.

This establishes the same two-way maximum at n = 3 and 4 without differentiation. It also explains exactly why the tie occurs: one step between those two integers produces zero net change.

Why an integer tie occurs at a half-integer vertex

For a quadratic f(n) = an²+bn+c, a tie between consecutive integers m and m+1 means f(m+1)−f(m) = 0.

Using the first-difference formula gives a(2m+1)+b = 0. Rearranging yields −b/(2a) = m + 1/2.

But −b/(2a) is precisely the vertex input. Thus two consecutive integers tie exactly when the vertex lies halfway between them.

For a < 0 they tie as maxima when unrestricted integer neighbours are considered; for a > 0 they tie as minima. This is a proof of the half-integer tie rule, not merely a numerical observation.

The cost of restricting an input to integers

Write a downward quadratic as f(x) = M−|a|(x−h)², where M is its continuous maximum.

If the closest permitted integer n has distance δ = |n−h| from the vertex, its best output is M−|a|δ².

Therefore the loss from the continuous optimum is |a|δ². For all integers allowed, δ cannot exceed 1/2, so the loss cannot exceed |a|/4.

In the opening example, |a| = 2 and δ = 1/2. The lost output is 2(1/4) = 1/2, matching the difference between continuous maximum 29.5 and integer maximum 29.

Don’t round the maximum output instead of the input

The continuous maximum 29.5 cannot simply be rounded to 30 or 29 to determine the discrete maximum. The correct output comes from evaluating the function at permitted inputs.

A different quadratic might have a continuous maximum of 29.49 but an integer-constrained maximum of 25, depending on curvature and how far the vertex is from allowed inputs.

Rounding an output is not the same operation as choosing a permitted input and recalculating the output. The shape of the function matters.

The reliable method finds the nearest admissible input and substitutes it into the original formula. Any rounding instruction for the final output should be applied only after that mathematically valid calculation.

Interpret a whole-number count in context

Suppose n is the number of complete sessions or products made. If the model gives its greatest continuous value at n = 3.5, there is no such count as three and a half complete items.

Choosing n = 3 or 4 may make both plans equally good under a quadratic model. Other practical criteria such as capacity, time or cost could then be used to break the tie.

A mathematical tie is not an error or evidence that the model lacks a maximum. It means more than one admissible input achieves the same best value.

Students should report every optimal count where the question asks for the count, and state any extra practical constraint separately instead of inventing one.

A restricted interval should be checked before using the vertex

For a maximum problem, first check whether the continuous vertex belongs to the real interval underlying the permitted integer set.

If the vertex is inside, the closest allowed integers are the natural candidates for a downward quadratic. If it lies outside, the optimum occurs at the nearest allowed boundary in the direction of the vertex.

If the allowed set is sparse or has missing values, use the nearest members of that set, not integers that violate the restrictions.

This domain-first strategy is consistent with ordinary constrained optimisation. The vertex gives mathematical direction, while the question’s allowed set determines what can actually be selected.

An exact check is preferable to a graph sketch

A parabola drawn on a graphing calculator may show its vertex at a fractional coordinate, but the plotted resolution may conceal whether two nearby integers tie.

For f(n) = −2n²+14n+5, the exact vertex 7/2 proves that 3 and 4 are equidistant. The exact values f(3)=f(4)=29 prove the tie.

A graph can provide a helpful visual explanation, showing the two lattice points at equal height on either side of the axis.

But algebra is stronger for determining equality. A graph’s pixel positions and rounded labels should not decide whether two answers are exactly the same.

A concise examination routine

First write the quadratic and the precise set of permitted inputs. Identify whether the problem requests a maximum or minimum.

Second find the continuous vertex h = −b/(2a), using differentiation or completing the square. Third inspect the opening direction and any finite-domain endpoints.

Fourth choose the nearest admissible integers for a maximum of a downward quadratic or a minimum of an upward quadratic. Evaluate every candidate exactly, including ties.

Finally state the optimal input or inputs and the best attainable function value. If needed, verify with first differences f(n+1)−f(n) or a completed-square distance argument. This makes the discrete restriction an explicit part of the proof.

Practice questions with checked answers

Question one: f(n) = −2n²+14n+5 for integer 0 ≤ n ≤ 7. Maximum: 29 at n = 3 and 4.

Question two: g(n) = −(n−17/5)²+10 for non-negative integer n. Maximum: 9.84 at n = 3.

Question three: h(n) = −3(n−5)²+40 for integer 0 ≤ n ≤ 10. Maximum: 40 at n = 5.

Question four: f(n) = −(n−8)²+50 for integer 0 ≤ n ≤ 5. Maximum: 41 at n = 5.

Question five: f(n) = −(n−5)²+30 for even n ∈ {0,2,4,6,8}. Maximum: 29 at n = 4 and 6.

Question six: f(n) = n²−4n+1 for integer 0 ≤ n ≤ 5. Maximum: 6 at n = 5.

For each, explain why the continuous vertex is or is not an admissible choice before calculating the final value.

Integer-constrained quadratic optimisation links parabolas, vertex form, differentiation, discrete sequences and real-world counting restrictions. The integer-domain extension is useful for mathematical modelling even where it is not an explicit assessed topic.

For Singapore syllabus reference, use the applicable SEAB documents for 2026 O-Level Additional Mathematics, 2027 SEC G3 or 2027 SEC G2, as appropriate.

Related guides include How to Find the Range of a Quadratic on a Restricted Interval, How to Find the Maximum Area of a Rectangle Under a Parabola and How to Prove a Quadratic Stays Above a Line for Every x. Browse the Additional Mathematics archive.

Families may enquire about suitable eduKate Singapore three-student Maths tutorials near Sixth Avenue MRT. The goal is to know when a perfect continuous answer is not a permitted answer and to optimise over the set the question actually allows. Properly taught kids shine a bright light into the future.