ForHosting KIT · Developer Utilities

Complex number to trigonometric form

The complex number to trigonometric form converter takes the real part a and the imaginary part b of a complex number and returns its polar description: the modulus r, which is the distance from the origin to the point (a, b) in the complex plane, and the argument theta, the angle the point makes with the positive real axis.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

You get the argument in both radians and degrees, plus a ready-to-copy trigonometric expression r(cos(theta) + i sin(theta)). It is the exact same computation a mathematics course does by hand, done deterministically in one call, with no rounding drift between machines and no approximation tricks — just hypot for the modulus and the two-argument arctangent for the angle.

From rectangular to trigonometric form

A complex number written as a + bi is in rectangular form: it names a point in the plane by walking a units along the real axis and b units along the imaginary axis. The trigonometric form describes the same point the way a navigator would — by distance and direction. The distance is the modulus, computed as the square root of a squared plus b squared, and the direction is the argument, the angle measured counterclockwise from the positive real axis. Written out, the number becomes r multiplied by the cosine of the angle plus i times the sine of the angle. Nothing about the number changes; only the description does. That change of description is exactly what makes multiplication, division, powers and roots of complex numbers simple, because in polar language those operations turn into multiplying moduli and adding angles. This endpoint performs the conversion in a single deterministic step and returns every piece of the result so you can use whichever part your calculation needs next.

How the modulus and argument are computed

The modulus is computed with the hypotenuse algorithm rather than the naive square root of the sum of squares, which matters for very large or very small components: the naive formula can overflow to infinity or underflow to zero even when the true answer is a perfectly ordinary number. The argument is computed with the two-argument arctangent, not with a plain arctangent of b over a. That distinction is what places the angle in the correct quadrant: one plus i and minus one minus i have the same ratio b over a, but they point in opposite directions, and only the two-argument version can tell them apart. The result is the principal value of the argument, lying in the half-open interval from minus pi to pi, returned in radians and converted to degrees. Both inputs must be finite numbers; passing a string that does not parse, an infinity, or a NaN is rejected as invalid input rather than silently coerced.

Where the conversion earns its place

Trigonometric form is the working representation anywhere complex numbers are multiplied repeatedly. Electrical engineers use it to combine impedances and phase shifts in AC circuit analysis, where the modulus is a magnitude and the argument is a phase angle. Signal processing code uses it to read the magnitude and phase of a frequency bin out of a Fourier transform. Students use it to apply De Moivre's theorem, which raises a complex number to a power by raising the modulus and multiplying the angle — nearly impossible in rectangular form, almost trivial in polar. This capability runs on our global edge with nothing stored after the call, and the same code that runs here runs free in your browser on this page, so you can check a single number by hand and only pay $0.002 per request when you automate the conversion inside a pipeline.

Prepare De Moivre power and root calculations

Convert a + bi to r(cos(theta) + i sin(theta)) so powers and nth roots reduce to arithmetic on r and theta.

Read magnitude and phase in AC circuit analysis

Turn an impedance given as resistance plus reactance into its magnitude and phase angle for combining with other components.

Interpret FFT output bins

Convert the real and imaginary parts of a frequency bin into its amplitude and phase in one deterministic call.

What does it cost?

$0.002 per request. It is also free to run in your browser on this page.

What range is the argument returned in?

The principal value: greater than minus pi and less than or equal to pi radians (minus 180 to 180 degrees), measured counterclockwise from the positive real axis.

What happens with the number zero?

Zero has modulus 0 and, by the convention of the two-argument arctangent, argument 0. The trigonometric form is 0 times any angle, so 0 is the value returned.

Why do I get an invalid input error?

Both the real and the imaginary part must be finite numbers. Infinity, NaN, missing fields and non-numeric strings are all rejected.

Why not just arctan(b/a) for the angle?

Because a single-ratio arctangent cannot distinguish opposite quadrants: 1 + i and -1 - i give the same ratio. The two-argument arctangent uses the signs of both parts and returns the correct angle.

Are the inputs stored anywhere?

No. The two numbers are processed and discarded; only the conversion result is returned.

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/math/complex-number-to-trigonometric-form

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/math/complex-number-to-trigonometric-form \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"real":1,"imag":1}'
{
  "real": 1,
  "imag": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.complex_number_to_trigonometric_form",
  "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.

Read the full KIT documentation →