# Does $\log(ab)^n$ equal $(\log(a)+\log(b))^n$ or $n\log(a)+n\log(b)$?

I think this might be a case of slight ambiguity in notation, but here goes:

On a test question, I was required to expand the expression $\log (ab)^n$. Since the logarithm is a function, I reasoned as follows:

\begin{align*} \log(ab)^n &= (\log(ab))^n\\ &= (\log(a)+\log(b))^n \end{align*}

However, after having our tests returned, I found that the teacher reasoned as follows:

\begin{align*} \log(ab)^n &= \log((ab)^n)\\ &= \log(a^nb^n)\\ &= \log(a^n)+\log(b^n)\\ &= n\log(a)+n\log(b) \end{align*}

I thought about asking, but decided to look in the textbook first, and found that the textbook does something like $\log(a+b)^n =n\log(a+b)$, so here I am.

My question is, which expansion is correct? Is one of them more standard than the other, or are they both acceptable interpretations? If you can link to some sources using one way or the other, that would also be appreciated.

-
Pick some values for $a$, $b$ and $n$ and try! –  Mariano Suárez-Alvarez Jan 6 '12 at 7:06
(I really hope no one answers this before you have the pleasure of finding out for yourself which of the two works) –  Mariano Suárez-Alvarez Jan 6 '12 at 7:10
The issue is not any conceptual misunderstanding, but one of convention. I think $\log (ab)^n$ is bad form precisely because of this confusion (is it $\log ((ab)^n)$ or (\log (ab))^n?), and should be avoided to the extent possible. Moreover, it is surprising exams rely on such "trick" questions where the student is tested on some arbitrary convention more than real mathematics. –  Srivatsan Jan 6 '12 at 7:12
@Mariano Suárez-Alvarez: I am not sure how I can calculate the expression for some numbers without knowing whether to take the logarithm or apply the power first. If I do log(2*3)^5, for example, without knowing which operation takes precedence I cannot find which one works. –  russell11 Jan 6 '12 at 7:22
But then your question is not the one you asked, but «what does $\log(ab)^n$ mean?». –  Mariano Suárez-Alvarez Jan 6 '12 at 7:23

Reading it in an article, my first impressions on the meaning would probably depend on the whitespace:

$$\text{log}(ab)^n \to \left(\text{log}(ab)\right)^n$$

and

$$\text{log }(ab)^n \to \text{log}\left( (ab)^n \right)$$

I would be a little surprised someone would interpret differently, but I can certainly imagine it.

If I saw it written flat like log(ab)^n, I would interpret it as (log(ab))^n, and would be dumbfounded to see anyone interpret it another way. (but then, maybe I program too much!)

The reasons for my impressions of the first version and the flat version are because they look like function evaluation expressions (i.e. something like $f(x)$), and so I visually parse it that way. The second version very much doesn't look like a function call, and it visually separates into two groups: "log" and "argument to log".

Now, as the comments said, things like this are a matter of convention, so in general you have to be aware of the possibilities, and infer from context what is going on.

I disagree with the comment that disparages testing on conventions, because they really are important. Communication is simply more efficient amongst people who follow the same conventions; at the very least, if a convention is adopted for a class, the student should know the convention, and be able to read course materials according to the convention.

(But, at the same time, I agree with that comment's sentiment that when confusion is possible, you should write in an unambiguous fashion)

-
+1. I like your explanation of how the interpretation might depend on extra context such as white space. // FWIW: I still don't quite see how this convention is useful or important. I think that the only convention that I consistently apply is that multiplication precedes addition; all other precedence rules beyond this seem tenuous to me. :-) –  Srivatsan Jan 6 '12 at 8:00
Nooooooo please don't make whitespace significant in mathematics! –  Rahul Jan 6 '12 at 8:21
Both answers were great, but I've chosen this one for its mention of whitespaces (while also talking about convention). Thanks! –  russell11 Jan 6 '12 at 8:23

As I mentioned in my comment, there is no conceptual misunderstanding at play here, but one of notational convention. I do not like the notation $\log x^n$ myself, precisely because of the confusion that the OP outlined: does it mean $(\log x)^n$ or $\log (x^n)$? It is best to disambiguate the expression by providing more context -- using an extra pair of parenthesis.

However, if we really must make sense out of that expression -- let’s say it appears in a test -- this is usually decided based on an “order of precedence” of logarithm and exponentiation. Of course, this order is again arbitrary, but for the sake of giving a more concrete answer:

I think the “usual” practice is to assign exponentiation a higher precedence than operations like log, sin, cos etc. For instance, according to this order, $\sin x^{-3}$ means $\sin (x^{-3})$ and $\log x^2$ means $\log (x^2)$, which agrees with your textbook/teacher and differs from your interpretation. (Sorry! :-))

However I will be quick to add that while the rule I just mentioned might be one convention, I do not know if this is the only one. Even if that is the case, the notation seems ambiguous enough that you should avoid it whereever possible.

-
While I agree that $\sin x^{-3}$ means $\sin(x^{-3})$, given $\sin(x)^{-3}$ I would interpret it as $(\sin x)^{-3}$. Also for what it's worth, WolframAlpha seems to agree with me. :) (Edit: can't get the caret to work on the link.) –  russell11 Jan 6 '12 at 8:10
@russell11 Aw, I see. Yes, even to me $\sin (x)^{-3}$ does look like $(\sin x)^{-3}$. :-) I am not sure I have a comprehensive explanation... –  Srivatsan Jan 6 '12 at 8:15
Don't forget that although $\sin^2(x) = (\sin(x))^2$ the notation changes for $\sin^{-1}(x) = \arcsin(x)$. So it is always a matter of convention on what exponents mean on functions. –  ja72 Jan 6 '12 at 16:37
@ja71: I agree that such conventions are hard to avoid. But while the convention you mention is immensely useful and standard (and hence cannot be avoided), the OP's question is about something much less common or useful (so, it should be avoided). I do not see the need to follow or recommend that convention: it's much easier to just make our intent explicit. –  Srivatsan Jan 6 '12 at 18:28

I think your answer was wrong, as your assumption would be correct having either $\log^n(ab)$ or $(\log(ab))^n$.

$$\log((ab)^n) = n \log(ab) = n(\log(a) + \log(b)) = n\log(a) + n\log(b)$$