On this page
When you punch `log(-5)` into a calculator, you get a syntax error. If you are preparing for your board exams or competitive tests like JEE, it is one of the first hard rules you meet in algebra: you cannot take the logarithm of a negative number.
For many students, this rule is just memorised as a reason to cross out a negative answer at the end of a long calculation. However, to truly understand why this rule exists, you have to look at what a logarithm is actually asking. Logarithms and exponential functions are two sides of the same coin, and the rules for one decide the limits of the other.
What does a logarithm actually ask?
A logarithm is the inverse of an exponential function. When you write y = log_b(x), you are asking a specific question: "To what power y must I raise the base b to get x?"
For example, log₂(8) = 3 because 2³ = 8.
In standard mathematics, the base of a logarithm (b) must be a positive number greater than zero, and it cannot be 1. The most common bases are 10 (common logarithm) and e (natural logarithm), both of which are strictly positive.
Why is the log of a negative number undefined?
The restriction comes from how positive numbers behave when you multiply them. According to the OpenStax *Algebra and Trigonometry* textbook, "Because the base of an exponential function is always positive, no power of that base can ever be negative."
Let's test this by trying to solve log₁₀(−100) = y. Rewriting this as an exponential equation gives us 10ʸ = −100.
Now, try to find a real number for y:
If y is positive (like 2), 10² = 100.
If y is zero, 10⁰ = 1.
If y is negative (like −2), 10⁻² = 1 / 10² = 0.01.
Whether the exponent is positive, negative or zero, a positive base raised to a real power always yields a positive fraction or whole number. It never crosses zero, and it never becomes negative. Because there is no real exponent that makes the equation true, the logarithm of a negative number is undefined.
How does this change the domain of a function?
Because a logarithm requires a positive input, it restricts the domain of any function that includes it. The domain of the standard logarithmic function f(x) = log_b(x) is strictly (0, ∞).
If you are dealing with a more complex argument, you must set the entire expression inside the logarithm to be strictly greater than zero.
A 3-step framework for finding a logarithmic domain:
Identify the expression inside the logarithm.
Set that expression strictly greater than zero (e.g., g(x) > 0).
Solve the inequality to find the allowed values of x.
For example, to find the domain of f(x) = log(x − 3), you set x − 3 > 0, which means x > 3. The function is only defined for numbers strictly greater than 3.
Let us look at a slightly harder example: finding the domain of f(x) = log(16 − x²). Following the framework, we set the argument greater than zero: 16 − x² > 0. This factors into (4 − x)(4 + x) > 0. By testing values in the intervals between the roots −4 and 4, we find that the inequality holds true only when x is between −4 and 4. Therefore, the domain of this function is (−4, 4).
You can read more about setting up these inequalities in our guide to functions for JEE: domain, range and composite functions done right.
If you are reviewing for an exam and need to revise how domain restrictions shift graphs, the Fermi Concept Library holds a lesson for each concept and its place in the map.
What about complex numbers?
If you continue into university-level mathematics, you will learn that logarithms of negative numbers *can* be defined using complex numbers and Euler's formula.
In the complex plane, the natural logarithm of −1 is iπ. However, this is part of complex analysis. In high school algebra, calculus and standard competitive exams, we only work with real-valued functions. When a real logarithm equation asks for the log of a negative number, the step-by-step solver in the Fermi Problem Library will point out the domain restriction and explain the reasoning rather than printing an answer. You can also explore how these cases differ from Solving equations in complex numbers by putting z = x + iy.
For all real applications, the rule holds firm: logarithms need positive inputs.



