# Solving inequality involving logarithms

I must be doing something wrong. I want to solve the following, where n is a positive integer, and p is a real number between 0 and 1.

$$(1-p)^n \le 0.4$$

So I take the log on both sides:

$$\log\big((1-p)^n\big) \le \log(0.4)$$ $$\log(1-p) \cdot n \le \log(0.4)$$ $$n \le \frac { \log(0.4)}{ \log(1-p)}$$

This would imply that there is a upper bound on n, instead of a lower one, which doesn't make sense, because $1-p \le 1$, and therefore the larger the exponent $n$ the smaller $(1-p)^n$ is.

What am I doing wrong?

Short answer: since $\log(1-p)$ is negative for $0<p<1$, you have to be careful dividing it over - the inequality flips!
hint: $\log (1-p)<0,$for $0<p<1$
Consider the case when you are solving $$-2x\leq6$$ You have to divide by $-2$ on both sides and you will end up with $x$ and $-3$ respectively. However, when you divide by $-2$, you are dividing by a negative number, thus the sign flips. $$x\geq-3$$
The same reasoning applies to log. When you take log on a number lesser than 1, you will end up with a negative number. Since the number changes from positive to negative, the sign changes from $\leq$ to $\geq$.