ForHosting KIT · Math

Nth roots of unity calculator

The fourth roots of unity are 1, i, -1 and -i, evenly spaced at 0°, 90°, 180° and 270° on the unit circle. Enter any order n from 1 to 360 and get every root in polar and rectangular form. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
4
You get
Equation
z^4=1
Quantity
4

The nth roots of unity are the complex numbers that satisfy z to the power n equals one. They sit evenly on the unit circle in the complex plane as the vertices of a regular n-gon, starting at one and stepping by angle two pi over n. Students meet them in algebra and complex analysis when factoring cyclotomic polynomials, diagonalizing circulant matrices, or applying the discrete Fourier transform. Engineers and signal-processing code need the same list in polar and rectangular form without pulling a full computer-algebra system. This nth roots of unity calculator accepts a positive integer order n, evaluates cos and sin at two pi k over n for each index k from zero through n minus one, and returns magnitude, argument in radians and degrees, a cis-style polar string, and a rectangular re plus i im string for every root. The algorithm is pure and deterministic, so homework checks, LMS plugins, and production edge workers always agree on the same rounded coordinates.

What the nth roots of unity are and how they are ordered

By definition a complex number omega is an nth root of unity when omega to the power n equals one. De Moivre's theorem gives an explicit parametrization: write one in polar form as magnitude one and argument zero, then take the n distinct nth roots by spacing the argument at two pi k over n for integer k from zero to n minus one. In rectangular form that is omega sub k equals cosine of two pi k over n plus i times sine of two pi k over n.

Geometrically the points are the vertices of a regular n-gon inscribed in the unit circle, always including the real number one when k is zero. For n equals two the roots are one and negative one; for n equals three they are one and the familiar pair negative one half plus or minus i times square root of three over two; for n equals four they are one, i, negative one, and negative i.

This capability returns roots in increasing k, which is counterclockwise order of argument, so clients can plot or tabulate without re-sorting. Every root has magnitude exactly one (reported as one after stable rounding), and the product of all roots is either one or negative one according as n is odd or even, matching the constant term of z to the n minus one.

Classroom and homework checks

Let students enter n and verify all nth roots of unity in polar and rectangular form against textbook De Moivre expansions.

Exam and LMS auto-grading

Mark complex-number items with a deterministic oracle that returns ordered roots and rejects non-integer or out-of-range n.

DFT and cyclotomic notebooks

Fetch unit-circle vertices for DFT twiddle factors or cyclotomic demos without importing a full computer-algebra library.

What input does the calculator need?

A single positive integer n between 1 and 360.

In what form are the roots returned?

Each root includes rectangular parts re and im, magnitude 1, angle in radians and degrees, plus polar (cis) and rectangular display strings.

Why do all roots of unity lie on the unit circle?

Each root has a magnitude of exactly 1, so its distance from the origin is 1. The n roots form the corners of a regular polygon that starts at 1 and steps around the circle in equal angles.

What are the fourth roots of unity?

They are 1, i, -1 and -i, at angles of 0°, 90°, 180° and 270°. Raising any of them to the fourth power gives 1, and they are listed counterclockwise starting from 1.

Which values of n does the calculator accept?

Any whole number from 1 to 360. Zero, negative numbers and fractions are refused, because the order of a root of unity must be a positive whole number.

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.

POSThttps://api.kit.forhosting.com/algebra/roots-of-unity

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.

curl -X POST https://api.kit.forhosting.com/algebra/roots-of-unity \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":4}'
{
  "n": 4
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.roots_of_unity",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Failed validation (missing n, non-integer n, or n outside the allowed range) raises invalid_input and is not billed.

What the nth roots of unity are and how they are ordered

Primitive roots are those with order exactly n (gcd of k and n equals one); the endpoint lists every root and leaves primitivity filtering to the caller when needed.

Input contract, response fields, and validation errors

On success the body echoes n, an equation string of the form z caret n equals one, count equal to n, a roots array, and a short formula string restating the cis identity. Example: n equals four yields four roots at arguments zero, pi over two, pi, and three pi over two, corresponding to one, i, negative one, and negative i. POST a JSON body with a single required field n: a positive integer between one and three hundred sixty inclusive. The upper bound keeps response size predictable for browser widgets and API clients while covering common classroom and DSP orders such as two, three, four, five, six, eight, twelve, sixteen, thirty-two, sixty-four, and three hundred sixty. Numeric strings that parse to a finite integer in range are accepted; missing n, empty strings, non-integers, zero, negatives, and values above three hundred sixty fail with invalid_input naming the field. Each root object carries k (zero-based index), re and im (rectangular parts rounded for stable goldens), magnitude (always one), angle_rad and angle_deg (argument in radians and degrees), polar (a cis-style display string), and rectangular (a human-readable re plus or minus i im string with compact handling of pure real and pure imaginary cases). Pair the response with your own charting code if you need a unit-circle diagram; this endpoint computes coordinates and labels only and does not emit plots or step-by-step symbolic proofs beyond the formula field.

Where an nth roots of unity API earns its keep

Algebra and complex-analysis courses use a roots of unity calculator so learners can check polar angles and rectangular coordinates for arbitrary n without hand-rounding cosine tables. Exam generators and LMS auto-graders need a deterministic oracle that rejects invalid n instead of inventing roots or silently truncating. Invalid input does not consume balance. Discrete Fourier transform notebooks, cyclotomic polynomial demos, and circulant-matrix utilities repeatedly need the same unit-circle vertices; calling a tiny parse API avoids shipping a symbolic math runtime for a single trigonometric loop.

What are the nth roots of unity?

They are the n complex solutions of z^n = 1, given by ω_k = cos(2πk/n) + i sin(2πk/n) for k = 0, 1, …, n−1, evenly spaced on the unit circle.

How are the roots ordered?

By increasing index k from 0 to n−1, which is counterclockwise order of argument starting at 1 (the real root when k = 0).

What does the nth roots of unity calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →