Square of a Complex Number Calculator
This square of a complex number calculator multiplies a complex number by itself and returns the answer in rectangular form.
Run — free
Enter the real and imaginary components of a + bi, and the calculator applies the binomial-square identity to produce the real and imaginary components of the result. It handles positive, negative, decimal, purely real, and purely imaginary values with the same deterministic calculation. The response is ready for algebra exercises, engineering formulas, software workflows, or a quick check of handwritten complex arithmetic.
Enter the real and imaginary components
Start by writing the complex number in rectangular form a + bi. Put a in the real field and b in the imaginary field. For example, enter 3 and 4 for 3 + 4i, or enter 3 and -4 for 3 - 4i. Both fields are required, even when one component is zero, because zero states that the component is present and has no value while an omitted field leaves the input incomplete. Use real numbers without appending i to the imaginary component. Integers, decimals, negative values, and zero are accepted, provided each value is finite. Text, infinity, and missing components cause an input error instead of being silently converted. That strict rule helps API clients find malformed data early and prevents a plausible-looking answer from an unintended coercion. A purely real number such as 7 is entered as real 7 and imaginary 0. A purely imaginary number such as -5i is entered as real 0 and imaginary -5. No polar conversion, angle, magnitude, or external complex-number library is needed before using the calculator.
Apply the binomial-square identity
The calculation comes directly from multiplying the number by itself: (a + bi)(a + bi). Expanding it as a binomial square gives a squared + 2abi + b squared times i squared. Because i squared equals -1, the last term changes sign and becomes -b squared. Collecting the ordinary and imaginary terms produces (a squared - b squared) + (2ab)i. The calculator therefore returns a squared minus b squared as the real component and twice a times b as the imaginary component. For 3 + 4i, the real component is 9 - 16, or -7, while the imaginary component is 2 times 3 times 4, or 24. The final rectangular result is -7 + 24i. Signs matter in both places: a negative imaginary input is squared positively in the real calculation but makes 2ab negative when the real input is positive. The algorithm follows this identity directly with a fixed number of arithmetic operations, so it has no random, network, or time-dependent behavior.
Read, verify, and reuse the result
The response contains separate real and imaginary fields, representing x + yi without requiring a formatted string to be parsed. This structure is convenient for passing the square into another equation, storing it as JSON, or displaying it with the sign style your application prefers. You can verify the result manually by checking the two identity components: x must equal a squared minus b squared, and y must equal 2ab. Another useful check uses magnitudes. The magnitude of a squared complex number equals the square of the original magnitude, although small last-digit differences can occur with decimal inputs because JavaScript uses finite binary floating-point arithmetic. Keep the returned precision for later calculations and round only when presenting a measurement. Inputs so large that their squared components exceed the finite numeric range are rejected rather than returned as infinity, which keeps the JSON result meaningful. This calculator returns the square, not either square root; squaring has one result for each input, whereas finding square roots generally produces two values. Automated API requests cost $0.002, and the tier-A calculation can also run directly in the browser.
What you can do with it
Check complex algebra homework
Verify the expansion of (a + bi) squared and compare both rectangular components with handwritten work.
Prepare engineering calculations
Square complex quantities used in circuit, signal, wave, or control formulas without converting to polar form.
Build deterministic math workflows
Produce separate numeric components that software can consume directly in JSON-based calculations.
FAQ
What formula squares a complex number?
For z = a + bi, the square is z squared = (a squared - b squared) + (2ab)i.
Why is b squared subtracted from a squared?
The expanded term b squared times i squared becomes negative because i squared equals -1.
Can I square a purely imaginary number?
Yes. Enter zero for the real part. For example, 0 + 5i squared returns -25 + 0i.
Does this calculator find complex square roots?
No. It squares one supplied complex number and returns its single result. Finding square roots is the inverse operation and usually returns two values.
What does an API calculation cost?
Each API request costs $0.002. The tier-A calculation is also designed to run free in the browser.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/complex-square \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"real":3,"imaginary":4}'const res = await fetch("https://api.kit.forhosting.com/algebra/complex-square", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"real": 3,
"imaginary": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/complex-square",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"real": 3,
"imaginary": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/complex-square", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"real":3,"imaginary":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"real":3,"imaginary":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/complex-square", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"real": 3,
"imaginary": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.complex_square",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |