Imaginary unit powers
The imaginary unit power calculator computes i raised to any integer exponent and returns the exact result: one of 1, i, -1 or -i.
Run — free
Because the powers of i repeat in a cycle of four, the answer is decided entirely by the remainder of the exponent modulo 4, which means the tool works instantly and exactly for huge positive exponents and for negative ones alike, where the reciprocal of i flips signs according to the same cycle. You send one integer and receive the result as a real part, an imaginary part, the residue of the exponent modulo 4 and a readable display string. The same deterministic code runs free in your browser and through the paid API, so what you test on this page is exactly what your integration receives.
Why the powers of i repeat in a cycle of four
The imaginary unit i is defined by the single equation i² = -1. That one fact generates everything else. Multiply by i once more and you get i³ = i²·i = -i. Multiply again and you get i⁴ = (-i)·i = -(i²) = 1, back where the sequence started. From there the pattern repeats forever: 1, i, -1, -i, 1, i, -1, -i. Because each block of four multiplications returns to 1, any exponent can be reduced to its remainder after division by 4 without changing the result: i^437 equals i^1 because 437 mod 4 is 1. On the complex plane each multiplication by i is a rotation of ninety degrees counterclockwise, so four multiplications complete a full turn and land back on the positive real axis. This calculator applies the cycle directly with an integer modulo, with no iteration, no floating-point trigonometry and no approximation, so the answer is deterministic: the same exponent always produces byte-identical output, whether the computation runs in your browser tab or on our edge servers through the API. The endpoint also reports the residue itself, so you can see which step of the cycle produced the result.
Negative exponents and the reciprocal of i
Integer powers include negative exponents, and they behave exactly as algebra demands: i^-n means 1 divided by i^n. The reciprocal of i is a classic surprise. Dividing 1 by i and rationalizing the denominator gives -i, because 1/i = i/i² = i/(-1) = -i. In geometric terms, negative powers rotate clockwise instead of counterclockwise, so i^-1 is a quarter turn down onto the negative imaginary axis. The four-step cycle still governs everything: i^-1, i^-2, i^-3 and i^-4 evaluate to -i, -1, i and 1 respectively, which is precisely the forward cycle walked backwards. This tool handles the sign correctly with a Euclidean modulo, which always returns a remainder between 0 and 3 even when the exponent is negative, so you never have to reason about the direction of rotation yourself. The exponent only needs to be an integer within the safe integer range of double-precision arithmetic, which covers any value you can type or compute in ordinary software. Fractional exponents such as 0.5 are rejected outright, because i^(1/2) is not a single value at all but a pair of square roots, and silently picking one would be a wrong answer disguised as a right one.
Where powers of i appear in real work
Cyclic powers of the imaginary unit are working machinery in several fields, not a classroom curiosity. In digital signal processing, the discrete Fourier transform multiplies samples by complex roots of unity, and for a four-point transform those roots are exactly the powers of i, so every radix-4 FFT butterfly is built from this cycle. In alternating-current circuit analysis, an inductor's impedance is jωL and a capacitor's is -j/(ωC): the j factors are powers of the imaginary unit encoding ninety-degree phase shifts between voltage and current. In computer graphics and robotics, multiplying a vector by i is the cheapest ninety-degree rotation in the plane, and chained powers describe successive quarter turns of a frame. In quantum mechanics the Schrödinger equation carries an explicit i, and time evolution operators accumulate powers of it. In all of these settings the arithmetic is trivial but the convention is not: an off-by-one in the cycle is a sign error that corrupts a phase, a rotation or a spectrum downstream. A deterministic endpoint with strict integer validation gives you a convention you can embed in tests, teaching tools and code generators, safe to cache, safe to retry and safe to run in parallel.
What you can do with it
Reduce huge exponents instantly
Evaluate i^1000000 or i^-987654321 without loops: the residue modulo 4 decides the answer, and the API returns it together with the result.
Verify a radix-4 FFT or DSP pipeline
Check your twiddle factors against the exact powers of i for the four-point stages, catching sign and ordering bugs at the source.
Build a teaching or homework tool
Generate exact quarter-turn results for exercises on the complex plane, phase shifts in AC circuits and rotations by ninety degrees.
FAQ
What does it cost?
$0.002 per request via the API. It is also free to run in your browser on this page — the same code executes both ways.
What is i raised to a negative power?
It follows the same four-step cycle walked backwards: i^-1 = -i, i^-2 = -1, i^-3 = i and i^-4 = 1. The tool accepts any safe integer, positive or negative.
What input does it expect?
A single integer: exponent (aliases n and power). A missing, non-numeric, non-finite or non-integer value is rejected with an invalid input error, because fractional powers of i are multi-valued.
What exactly does the response contain?
The real and imaginary parts of the result (one of 1, i, -1, -i), the exponent reduced modulo 4 as residue, an echo of the input, and a display string such as "-i" you can render without reformatting.
Why is the result always one of four values?
Because i² = -1, four successive multiplications by i return to 1, so the powers repeat in the cycle 1, i, -1, -i. Geometrically each power is a ninety-degree rotation of the complex plane.
Is the result deterministic?
Yes. The computation is a single integer modulo with no randomness, clocks, iteration or network access, so identical exponents always produce identical output on any machine.
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/math/imaginary-number \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"exponent":7}'const res = await fetch("https://api.kit.forhosting.com/math/imaginary-number", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"exponent": 7
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/imaginary-number",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"exponent": 7
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/imaginary-number", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"exponent":7}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"exponent":7}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/imaginary-number", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"exponent": 7
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.imaginary_number",
"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. |