ForHosting KIT · Developer Utilities

Expanding logarithms

Expanding logarithms means taking a single logarithm whose argument is built from multiplications, divisions and powers — say log base 2 of x·y/z — and rewriting it as a sum of simpler logarithms: log₂(x) + log₂(y) − log₂(z).

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

This API does that rewrite for you. You send the base and the list of factors with their operations, and you get back the expanded expression, one term per factor, with the correct signs and coefficients. Numeric arguments are validated: a logarithm is only defined for positive arguments, so any factor that is zero or negative is rejected with a clear error instead of producing a meaningless expression.

What expanding a logarithm means

The three laws of logarithms turn structure inside the argument into structure outside it. The product rule says log_b(x·y) equals log_b(x) plus log_b(y): multiplication inside becomes addition outside. The quotient rule says log_b(x/y) equals log_b(x) minus log_b(y): division inside becomes subtraction outside. The power rule says log_b(x^n) equals n times log_b(x): an exponent inside slides out front as a coefficient. Expanding a logarithm is applying these laws left to right until nothing inside any logarithm can be broken down further. Students meet this when simplifying expressions before differentiating, when solving exponential equations, and when linearizing data for a log-log plot. The operation is purely mechanical once you identify each factor and how it enters the argument, which is exactly why it suits an API: you describe the expression as a base plus a list of operations and factors, and the expansion comes back as a ready-to-use string with each term spelled out, its sign, its coefficient and its argument.

How to describe your expression to the API

The input has two parts. The base is the logarithm's base: any positive number other than 1, so 2, 10 and e all work, while 1, 0 and negatives are rejected because no real logarithm has such a base. The terms array lists the factors of the argument in order. Each term names an operation — multiply, divide or power — and an argument. A multiply term contributes its log with a plus sign, a divide term with a minus sign, and a power term with its exponent pulled out as a coefficient in front. So log base 2 of x·y/z³ is three terms: multiply x, multiply y, and power z with exponent 3, which expands to log₂(x) + log₂(y) − 3·log₂(z). Arguments can be symbolic, like x or price, when you want the algebraic form, or numeric, like 8, when you want a concrete check. Numeric arguments must be positive; symbolic ones are kept verbatim because their sign depends on the values you later assign. A negative exponent on a power term simply flips the term's sign, since x to the minus n is the same as dividing by x to the n.

Why validation of the domain matters

A real logarithm is only defined for strictly positive arguments. log of zero diverges to minus infinity and log of a negative number is not a real number at all, so an expansion built on a non-positive factor would be symbolic noise that silently breaks the moment anyone evaluates it. This endpoint refuses to produce that noise: when a numeric argument is zero or negative, the call fails with an invalid-input error naming the offending term, and you are not charged for the call. The same strictness applies to the base, which must be positive and different from 1, and to exponents, which must be finite numbers — an exponent of zero is rejected because the term would contribute log of 1, which is zero and almost always a mistake in the input. The result is deterministic: the same request always returns the same string, byte for byte, which makes the endpoint safe to use inside generated worksheets, automated graders and CI checks that compare outputs literally. It runs on our edge with nothing stored, and the identical algorithm runs free in the browser on this page, so you pay $0.002 per call only when you automate it.

Generate worked algebra exercises

Feed a base and a factor list and embed the expanded form directly into worksheets, quizzes or step-by-step solutions.

Check homework answers automatically

Compare a student's expanded expression against the canonical string the API returns for the same base and terms.

Simplify before differentiating

Expand log of a product or quotient into a sum so each term differentiates separately, a standard step in calculus workflows.

What does it cost?

$0.002 per request. The same algorithm also runs free in your browser on this page.

Which bases are accepted?

Any positive number except 1: 2, 10, e or any other valid base. Bases of 1, 0 or negative numbers are rejected.

Can the factors be variables instead of numbers?

Yes. An argument may be symbolic (x, price, velocity) or numeric. Numeric arguments must be positive; symbolic ones are kept as written.

What happens if an argument is zero or negative?

The call fails with an invalid-input error naming the term, because a real logarithm is undefined there. You are not charged for rejected calls.

How do powers expand?

A power term with exponent n contributes n times the log of its argument; a negative exponent flips the term's sign. An exponent of 0 is rejected.

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/expanding-logarithms

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/expanding-logarithms \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"base":2,"terms":[{"operation":"multiply","argument":"x"},{"operation":"multiply","argument":"y"},{"operation":"divide","argument":"z"}]}'
{
  "base": 2,
  "terms": [
    {
      "operation": "multiply",
      "argument": "x"
    },
    {
      "operation": "multiply",
      "argument": "y"
    },
    {
      "operation": "divide",
      "argument": "z"
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.expanding_logarithms",
  "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.

max_terms32
max_abs1000000000000
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 →