Exercise 1: The Division Algorithm for a Negative Dividend, -29 / 4 — Possible Solution ==================================================================== GIVEN ------------------------------ a = -29, d = 4. Find the unique q, r satisfying a = d*q + r with 0 <= r < 4. STEP 1: FIND q AND r ------------------------------ -29 / 4 = -7.25. Since r must be non-negative (0 <= r < 4), q must be the LARGEST integer such that d*q does not exceed a - in other words, q is the floor of -7.25, which is -8 (not -7, since -7 is larger than -7.25, and rounding toward -7 would make r negative). q = -8 r = a - d*q = -29 - (4 * -8) = -29 - (-32) = 3 CHECK: 4*(-8) + 3 = -32 + 3 = -29. Correct, and 0 <= 3 < 4 holds. STEP 2: WHY q=-7, r=-1 IS NOT VALID, EVEN THOUGH THE ARITHMETIC WORKS ------------------------------ 4*(-7) + (-1) = -28 + (-1) = -29 - this is arithmetically true, the equation a = d*q + r does hold for this pair too. However, the division algorithm requires MORE than just the equation holding - it specifically requires 0 <= r < d. Here, r = -1, which is NEGATIVE - it fails the requirement 0 <= r outright. The division algorithm's own uniqueness guarantee comes specifically from this extra constraint: infinitely many (q, r) pairs satisfy a = d*q + r on their own (increase q by 1, decrease r by d, and the equation still holds), but only ONE of them also satisfies 0 <= r < d. That one pair - q=-8, r=3 - is the only valid answer under this chapter's own definition. WHY THIS WORKS AS AN ANSWER ------------------------------ The correct q and r are derived by reasoning about which integer q keeps r inside the required range, not by rounding toward zero, and the invalid pairing is explicitly shown to satisfy the raw equation while still being rejected - correctly identifying that the extra range constraint, not the equation alone, is what makes q and r unique.