Programming & Compilers
Principal square root products: check negative inputs
An exact real-input tutorial separates a valid square root from the principal selected root and proves the full sign-case criterion.

Principal square root products require a sign check before you replace two selected roots by one root of a product. For real inputs, the replacement agrees with the convention used here except when both inputs are strictly negative. The pair −4 and −9 makes the failure visible: their principal roots are 2i and 3i, whose product is −6. Multiplying the inputs first gives 36, whose principal root is +6. Both answers square to 36. Only one is the selected principal root of 36.
This tutorial uses real inputs and allows complex outputs. Let i denote the imaginary unit, with i² = −1, and use ordinary complex arithmetic throughout. We will state the root-selection convention explicitly, work the two routes separately and prove the complete sign criterion. No calculator mode, software library behavior or product measurement is assumed. The word “principal” supplies a selection rule; the equation saying that an output squares to an input supplies a different check. Keeping both on the page prevents a correct square from being mistaken for a correct selection.
Define one selected output for each real input
Write S(r) for the principal square root of a real number r under the following convention. If r is nonnegative, S(r) is its nonnegative real square root. If r is negative, S(r) is i times the positive real square root of −r. Thus S(4) = 2, S(9) = 3 and S(0) = 0. For the negative counterparts, S(−4) = 2i and S(−9) = 3i. The imaginary coefficient is positive in those negative-input cases.
Each selected output squares to its input. For example, (2i)² = 4i² = −4, and (3i)² = 9i² = −9. The outputs −2i and −3i also square to −4 and −9 respectively, but our stated selection chooses the positive imaginary coefficient. For a positive input such as 36, both +6 and −6 square to that input, while S(36) chooses +6. These alternatives explain why a square check alone cannot tell us whether the principal convention has been followed.
The real-input restriction is part of this exercise. We have defined S on the entire real number line, including negative values, by allowing its outputs to be complex. We have not specified its value at an arbitrary nonreal complex input. Every argument below uses only the stated real-input convention. If you are working in real arithmetic alone, a negative real input has no real square root; you cannot import the complex output silently while leaving the declared output domain unchanged.
Calculate the roots-first route
Begin with u = −4 and v = −9. Select their roots individually, giving S(u) = 2i and S(v) = 3i. Multiply those selected outputs in ordinary complex arithmetic: S(u)S(v) = (2i)(3i) = 6i² = −6. The negative sign follows from i² = −1. It is not a rounding effect or a choice made after seeing the final answer. Once the two principal roots have been selected, their product is fixed by the declared arithmetic.
Check that result by squaring it: (−6)² = 36. Also check the product of the original inputs: (−4)(−9) = 36. Therefore the roots-first result is indeed a square root of the input product. That property has survived multiplication. What remains to be checked is whether the same result satisfies the principal selection for a positive real input. Because −6 is negative, it fails that particular selection condition even though its square is exactly right.
Calculate the product-first route
Keep the original inputs unchanged and multiply them before applying S. Their product is positive: uv = 36. The nonnegative-input branch of the definition then gives S(uv) = S(36) = +6. Comparing the complete routes yields S(−4)S(−9) = −6 and S((−4)(−9)) = +6. The parentheses identify which operation takes place first. Removing them and moving S across the multiplication would replace one value by a different value in this example.
The smaller pair u = v = −1 gives the same discrepancy with fewer coefficients. Here S(−1)S(−1) = i × i = −1, whereas S((−1)(−1)) = S(1) = +1. Squaring either answer gives one. This control confirms that the mismatch does not depend on choosing the magnitudes two and three. A single pair would disprove an unrestricted identity; the next step identifies exactly which real-input sign cases cause the mismatch.
Prove the case with two negative inputs
Let u and v be arbitrary strictly negative real numbers. Write u = −a² and v = −b², where a and b are positive real magnitudes. By definition, S(u) = ia and S(v) = ib. Their product is (ia)(ib) = −ab. Meanwhile uv = a²b² = (ab)² is positive, and ab is positive. Its principal square root is therefore +ab. Since ab is greater than zero, −ab and +ab are unequal. Every pair of strictly negative real inputs produces the discrepancy.
The same calculation shows why both route results remain legitimate roots of uv. Squaring −ab gives a²b², just as squaring +ab does. The defect is specifically in preserving the principal choice under the proposed rearrangement. It would be inaccurate to call −ab a number whose square is wrong. It would also be inaccurate to change the definition of S after multiplication so that it accepts whichever sign the roots-first route happened to produce. The convention stays fixed for every evaluation.
Check positive and mixed signs
Suppose both inputs are strictly positive, with u = a² and v = b² for positive real a and b. Their selected roots are a and b, so the roots-first product is ab. The input product is (ab)², whose nonnegative real root is also ab. Thus the two routes agree. With u = 4 and v = 9, the calculation reads S(4)S(9) = 2 × 3 = 6 and S(36) = 6. There is no imaginary factor in either selected root in this case.
Now take one negative input and one positive input, writing u = −a² and v = b² with a and b positive. Selecting first gives (ia)b = iab. Multiplying first gives uv = −(ab)², which is negative. Its selected root under our convention is i times the positive magnitude ab, also iab. For u = −4 and v = 9, both routes give 6i. Squaring that output gives −36, matching the negative product of the original inputs.
Reversing those mixed-sign inputs does not change the conclusion. For u = a² and v = −b², selecting first gives a(ib) = iab, while the selected root of −(ab)² is again iab. These two mixed cases contain one factor of i rather than two. Consequently they produce a positive imaginary coefficient under the convention. Keeping the cases separate in the calculation explains why the presence of any negative input is too broad a failure test: exactly two strictly negative inputs are needed here.
Include zero and justify the magnitude choice
If either input is zero, one selected root is S(0) = 0, so their product is zero. The product of the original inputs is also zero and its selected root is zero. For example, S(0)S(−9) = 0 × 3i = 0, agreeing with S(0 × −9) = 0. Zero must be handled explicitly because it is not strictly positive or strictly negative. It also explains why the strict inequality in the two-negative failure criterion matters.
The magnitude step used above can be checked without assuming the identity we are testing. If a and b are nonnegative, ab is nonnegative and its square equals a²b². If another nonnegative number q has that same square, then q² − (ab)² = (q − ab)(q + ab) = 0. When ab is positive, q + ab is positive, forcing q = ab. When ab is zero, q² = 0 forces q = 0. Thus ab is the unique nonnegative magnitude needed by the selection rule.
This argument does not move a square root across an arbitrary multiplication as an unexplained rule. It verifies a proposed nonnegative magnitude by squaring it and checking uniqueness in the allowed sign range. In the negative-input branch, that same positive magnitude is multiplied by i as the definition requires. The factorization therefore supports both the positive-product and negative-product cases without assuming that the principal complex-root map itself preserves every product. The selection and the arithmetic remain separately checkable.
Use the complete real-input criterion
Every pair of real inputs belongs to one of the cases just checked: a zero input, two strictly positive inputs, mixed strict signs, or two strictly negative inputs. The routes agree in the first three cases and differ in the last. Therefore S(u)S(v) = S(uv) exactly when u and v are not both strictly negative. This is a statement about the declared map on real inputs. It supplies no rule for arbitrary complex inputs, whose root-selection convention has not been defined in this tutorial.
When checking a worksheet, preserve the two inputs and write both expressions before substituting their values. Record the selected root of each input, their product, the product of the inputs and its selected root. A square check then confirms root membership, while the stated sign convention confirms selection. For −4 and −9, the record ends with two correct squares and two different selected-route values, −6 and +6. Changing a coefficient or attaching a ± symbol to S would conceal the exact question those values answer.
The same criterion applies to fractional magnitudes. With u = −1/4 and v = −9, the selected roots are i/2 and 3i. Their product is −3/2, while uv = 9/4 has selected root +3/2. Squaring either route result gives 9/4. The two-negative case therefore persists when an input lies between minus one and zero; a test based only on large negative integers would miss part of the stated real-input domain.
Keep decorative references outside the calculation
The COMPUKAS decorative vase account shows a tall woven-looking vessel with a flared mouth and a “FLOWER” patch. Its gallery includes room staging and detail views. The decorative word does not authenticate a maker or establish a brand alias. No physical dimension, material, waterholding or durability result is adopted here.
The Gold Streak decorative vase account shows an ovoid vessel with a short circular neck and a crosshatched-looking surface. Other vessels appear in staging, which does not establish a supplied set. Neither this form nor the first vessel supplies a complex-number operation, a root-selection convention or evidence for the sign criterion.
Keep the neighboring mathematical questions distinct
The imaginary unit pair model guide constructs an operation on real pairs and proves a multiplicative sum-of-squares measure. It explicitly leaves principal complex-root selection outside that construction. Here ordinary complex arithmetic is already available; the decision concerns whether a selected-root map preserves a particular multiplication.
The extraneous solution after squaring guide checks candidates in an unchanged original real radical equation. This tutorial transforms no equation and filters no candidate list. Its two route results both square to the product, while the fixed principal convention selects only the positive real result for that positive input.
If a later purchase uses cryptocurrency
The selected-root calculations do not describe a payment instruction or establish whether a purchase can be reversed. If you later consider a linked listing, confirm the exact selected item and the current order terms before deciding to buy. If the checkout offers cryptocurrency and you choose that option, read its actual request for the asset, network, destination and amount. Confirm that those details match the intended order and the transfer you are preparing. A matching token name alone does not settle the network or destination. The signs and imaginary coefficients in this tutorial provide no information about any of those transaction details.
Review any disclosed fees, confirmation requirements and refund procedure before sending funds, and retain the order identifier and payment reference supplied for the transaction. If an attempted payment leaves the order status uncertain, reconcile that attempt through the stated support process before making another payment. An unchanged screen is not evidence that the previous transfer never happened. This article does not promise that cryptocurrency is available for either listing, that a transfer will settle at a particular speed, or that a refund will use the same asset or network. Those questions depend on the actual checkout and the terms presented for that order.