# Complex Number Calculator

> Performs arithmetic on two complex numbers written as strings such as '3+4i', or computes the modulus, conjugate or polar form of one, and reports the real and imaginary parts, modulus and argument of the result.

- Calculator id: `complex-numbers` · Category: Math (`math`) · Tool name: `calculate_complex_numbers`
- Canonical page: https://tttkmbb.com/math/complex-numbers · This document: https://tttkmbb.com/math/complex-numbers.md · JSON definition: https://tttkmbb.com/math/complex-numbers.json

## Purpose

Performs arithmetic on two complex numbers written as strings such as '3+4i', or computes the modulus, conjugate or polar form of one, and reports the real and imaginary parts, modulus and argument of the result.

**Use when:** You need to combine complex numbers in rectangular form (a + bi), convert between rectangular and polar form, or find |z| and arg(z).

**Do not use when:** You want the complex roots of a polynomial (use quadratic-equation or cubic-equation) or trigonometric values of a real angle (use trigonometry).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `z1` | string |  | required | First complex number in rectangular form, e.g. '3+4i', '-2.5i', '7' or '1-i' (j is accepted for i). |
| `z2` | string |  | optional | Second complex number; required for add, subtract, multiply and divide, ignored otherwise. |
| `operation` | enum: add \| subtract \| multiply \| divide \| modulus \| conjugate \| polar |  | optional, default "add" | Binary operations use z₁ and z₂; modulus, conjugate and polar use z₁ only. |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `result` | string |  | The result in rectangular form, e.g. '-1+2i' (for polar: 'r∠θ°'). |
| `real` | number |  | Re(result) (for polar: Re(z₁)). |
| `imaginary` | number |  | Im(result) (for polar: Im(z₁)). |
| `modulus` | number |  | √(real² + imaginary²) of the result. |
| `argument_degrees` | number | ° | atan2(imaginary, real) in degrees, in (−180°, 180°]. |
| `argument_radians` | number | rad | The principal argument in radians. |
| `polar_form` | string |  | The result as 'r∠θ°' and 'r·e^(iθ)' with θ in radians (6 significant digits). |
| `conjugate` | string |  | The conjugate of the result (imaginary part negated). |
| `expression` | string |  | The evaluated operation as text, e.g. '(3+4i) ÷ (1-2i) = -1+2i'. |

## Formula

`(a+bi) ± (c+di) = (a±c) + (b±d)i; (a+bi)(c+di) = (ac − bd) + (ad + bc)i; (a+bi)/(c+di) = ((ac + bd) + (bc − ad)i) / (c² + d²); |z| = √(a² + b²); arg z = atan2(b, a); conj(z) = a − bi`

## Data Sources

- Wikipedia – Complex number — https://en.wikipedia.org/wiki/Complex_number (reference, retrieved 2026-09-24)
- NIST Digital Library of Mathematical Functions §1.9 – Calculus of a complex variable: complex numbers — https://dlmf.nist.gov/1.9 (standard, retrieved 2026-09-24)
- Wolfram MathWorld – Complex Number — https://mathworld.wolfram.com/ComplexNumber.html (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/complex-numbers?z1=…`
- `POST https://tttkmbb.com/api/v1/calculate/complex-numbers` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/complex-numbers · OpenAPI operationId `calculate_complex_numbers` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "complex-numbers", "inputs": {…}}`

## Example

- (3+4i) ÷ (1−2i): inputs `{"z1":"3+4i","z2":"1-2i","operation":"divide"}` → `{"result":"-1+2i","real":-1,"imaginary":2,"modulus":2.236068,"argument_degrees":116.5651,"argument_radians":2.034444,"conjugate":"-1-2i","expression":"(3+4i) ÷ (1-2i) = -1+2i"}`
- Polar form of 3+4i: inputs `{"z1":"3+4i","operation":"polar"}` → `{"result":"5∠53.1301°","real":3,"imaginary":4,"modulus":5,"argument_degrees":53.1301,"argument_radians":0.927295,"polar_form":"5∠53.1301° = 5·e^(0.927295i)"}`

```
GET https://tttkmbb.com/api/v1/calculate/complex-numbers?z1=3%2B4i&z2=1-2i&operation=divide
```

## Limitations

You want the complex roots of a polynomial (use quadratic-equation or cubic-equation) or trigonometric values of a real angle (use trigonometry). All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**How is division computed?**

Numerator and denominator are multiplied by the conjugate of the divisor: (3+4i)/(1−2i) = (3+4i)(1+2i)/(1² + 2²) = (−5 + 10i)/5 = −1 + 2i.

**Which range is the argument in?**

The principal value from atan2, −180° < θ ≤ 180° (−π < θ ≤ π), measured counter-clockwise from the positive real axis.

## Related

- [Quadratic Equation Solver](https://tttkmbb.com/math/quadratic-equation.md) — Source of complex conjugate roots.
- [Cubic Equation Solver](https://tttkmbb.com/math/cubic-equation.md) — Cubics with a complex root pair.
- [Trigonometry Calculator](https://tttkmbb.com/math/trigonometry.md) — cos θ and sin θ used in the polar form.
