# Under what circumstances can one divide by a variable?

In light of recent responses to my other questions, I would like to know when it is mathematically acceptable to undergo division by a variable or a function of a variable, i.e., $x$ or $\cos x$. From what I sort of understand, it is only acceptable to divide by $x$ when $x$ is known not to be $0$. For all other cases, division cannot be undergone. In addition, I believe my Precalculus teacher said diving by $\cos x$ also should not occur because $\cos x$ can equal $0$ at $x=\frac{(2n-1)\pi}2$ where $n\in \mathbb{Z}$. How can I avoid dividing by $0$? Under what other circumstances could I accidentally divide by $0$?

• So, if you know that $x \neq (2n-1)\frac{\pi}{2}$ then you can safely divide by $\cos x$, etc... if you know that $x \neq 1$ then you can safely divide by $\ln x$, and so on. – Zain Patel Aug 17 '16 at 0:38
• See this previous question: Why should you never divide both sides by a variable when solving an equation? In short, you have to consider both cases separately: (a) suppose $x\ne0$, then you can divide by it and proceed; (b) suppose $x=0$, then see what happens to the original problem. – Rahul Aug 17 '16 at 0:41
• I'm sorry I jumped on you. I miss understood what you were trying to say. If you get, say, $x^2 + 3x = x (x - 6)$ and you want to divide by x, you can **IF** you specify you are doing a case where $x \ne 0$ AND when you have finished that case you address and show what happens when you assume x = 0. – fleablood Aug 17 '16 at 5:31
• every time you divide by an unknown you should note "this assumes so and so isn't 0. I will discuss what happens if so and so does equal 0 later." And then do explain later. Or if you know so and so can not be 0 you can say "we know so and so can not be 0 because... therefore we can divide by it" – fleablood Aug 17 '16 at 5:37
• In a way this is what $xy = 0$ so $x=0$ OR $y= 0$. You are taking two cases and considering each seperately. – fleablood Aug 17 '16 at 5:39

## 3 Answers

Let's do two examples:

1) Suppose you are asked to solve:

$x^4 + 5x^2 +4 = 4x^3 + 4x$. And you decide to factor both sides:

$x^4 + 5x^2 + 4 = 4x^3 + 4x$

$(x^2 + 4)(x^2 + 1) = 4x(x^2 + 1)$

And now at this point you realllllly want to divide both sides by $x^2 + 1$. Can you? Well, you can if $x^2 + 1 \ne 0$. So you write (and you must write something to this effect):

"As $x^2 \ge 0$ we know $x^2 + 1 \ge 1 >0$ and in particular, we know $x^2 + 1 \ne 0$. So we may safely divide by $x^2 + 1$."

And then you go on with:

$x^2 + 4 = 4x$ ... and so on....

2) Okay... second example. Suppose you are asked to solve:

$x^4 -3x^2 -4 = 4x^3 - 4x$. And you decide to factor both sides:

$x^4 -3x^2 - 4 = 4x^3 - 4x$

$(x^2 + 4)(x^2 - 1) = 4x(x^2 - 1)$

And now at this point you realllllly want to divide both sides by $x^2 - 1$. Can you? Well, you can if $x^2 - 1 \ne 0$.

But $x^2 -1$ might equal $0$!!!! So what do you do? You break it into cases and write something to the effect:

"$(x^2 + 4)(x^2 - 1) = 4x(x^2 - 1)$

"If we assume $x^2 - 1 \ne 0$ we may divide both sides by $x^2 - 1$

"So we will assume that so we'll do Case 1:

"Case 1: $x^2 - 1 \ne 0$

"then

"$x^2 + 4 = 4x$

$x^2 - 4x + 4 = 0$

$(x - 2)^2 = 0$

$x -2 = 0$

$x = 2$

"But we have the restriction that $x^2 - 1$ can not be $0$ so we must test that this is not the case: If $x = 2$ then $2^2 - 1 = 3 \ne 0$ so this is okay

"So we conclude that if $x^2 - 1 \ne 0$ then $x = 2$.

"But we must also consider that $x^2 - 1$ might equal 0, so we do Case 2:

"Case 2: $x^2 - 1 =0$

"then $x^2 = 1$ so $x = \pm 1$.

"Our conclusion of the two cases is either $x = 2$ or $x = -1$ or $x = 1$".

====

The above is for more verbose than any actual example need to be. It be sufficient to do something like this:

Question Solve for $x$: $x^4 + 5x^2 + 4 = 4x^3 + 4$

Answer:

$x^4 + 5x^2 + 4 = 4x^3 + 4$

$(x^2 + 4)(x^2 + 1) = 4x(x^2 + 1)$

$(x^2+4)\frac{x^2 + 1}{x^2 + 1}=4x\frac{x^2 + 1}{x^2 + 1}$; [$x^2 \ge 1$ so $x^2 + 1 \ne 0$]

$x^2 + 4 = 4x$

$x^2 - 4x + 4 = 0$

$x = \frac {2 \pm \sqrt{2^2 - 4*1}}{2*1} = 2$.

~~~~~~~~~

Or you could do:

$x^4 + 5x^2 + 4 = 4x^3 + 4$

$(x^2 + 4)(x^2 + 1) = 4x(x^2 + 1)$

Case 1: $x^2 + 1 \ne 0$

$(x^2+4)\frac{x^2 + 1}{x^2 + 1}=4x\frac{x^2 + 1}{x^2 + 1}$

$x^2 + 4 = 4x$

$x^2 - 4x + 4 = 0$

Case 2: $x^2 + 1 = 0$.

$x^2 + 1 = 0$

$x^2 = -1$

Impossible.

$x = 2$.

`

What is not acceptable is:

$x^4 + 5x^2 + 4 = 4x^3 + 4$

$(x^2 + 4)(x^2 + 1) = 4x(x^2 + 1)$

$(x^2+4)\frac{x^2 + 1}{x^2 + 1}=4x\frac{x^2 + 1}{x^2 + 1}$

$x^2 + 4 = 4x$

$x^2 - 4x + 4 = 0$

$x = \frac {2 \pm \sqrt{2^2 - 4*1}}{2*1} = 2$.

• I upvoted this because it covers the essential cases as I see them. I would like the answer even better if it reached the same conclusions in fewer words than its first version. – David K Aug 17 '16 at 19:39
• I obviously don't expect the student to be as verbose and pendantic as this. But I wanted it to be absolutely clear that when I do divide by an unknown (and every time) that we must either determine that unknown can not be 0, or that if it can, we are doing a specific case under stringent conditions and that the case of other conditions must be addressed. – fleablood Aug 17 '16 at 21:08
• The one case I didn't cover is when after you divide by the unknown you determine that the unknown must be zero. So we were incorrect in dividing at all. Example $\cos(2x)*(\sin(x) - 1/2) = (sin(x) - 1/2)*1/2$ so $\cos(2x) = 1/2$ so $2x = 60|120$ so $x = 30|60$ but if $x = 30$ $\sin(x) -1/2 = 0$ which we assumed wasn't the case. In a way that isn't really a problem as our second case was going to be $\sin(x) -1/2 =0$ so even if we dropped the ball in case 1: it would be a result in case two anyway. – fleablood Aug 17 '16 at 21:16
• I didn't mean to suggest removing any of the points made by the answer. The answer is not far from its ideal length. In fact, now that you've made clear that it is written to make clear the things to think about, not necessarily as a model for writing up a solution to a problem, it seems fine. – David K Aug 18 '16 at 16:55

First things first: I think you meant $n \in \mathbb{Z}$ instead of $n \in \mathbb{R}$ for $x= \frac{(2n-1)\pi}{2}$. $\mathbb{R}$ stands for real numbers. This are numbers like 1 and 2, but also $\frac{2}{3}$ and $\pi$. $\mathbb{Z}$ stands for integers. So $1 \in \mathbb{Z}$ and $1 \in \mathbb{R}$, but $\pi \notin \mathbb{Z}$ while $\pi \in \mathbb{R}$.

Now for the real question.

$\cos$ is essentially a function, just like $f(x)$.

Say you want to divide by a function $f(x)$ (where $f(x)$ can be any function). You can do this for any value of $x$ for which $f(x) \neq 0$ (as far as I know at least for $x \in \mathbb{R}$).

Say for example $f(x) = x - 5$. You can divide by $f(x)$ if $x \neq 5$.

The same holds for $\cos$. So let's say we have $\cos(x)$ (or $f(x) = \cos(x)$ if you like). $\cos(x) = 0$ if, as you pointed out, $x=\frac{(2n-1)\pi}{2}$ with $n \in \mathbb{Z}$. Since we want to devide by $\cos(x)$, we must be sure that $x \neq \frac{(2n-1)\pi}{2}$.

More general, if we want to devide by $f(g(x))$, we calculate $f(a) = 0$ and set this $a$ equal to $g(x)$ (so we calculate $g(x) = a$). The resulting value(s) of $x$ is for which we can't devide by $f(g(x))$.

As a concrete example, say we have $$g(x) = x^2 + 6x$$ and $$f(g(x)) = g(x) + 5$$ and we want to determine for which values of $x$ we can calculate $$h(x) = \frac{1}{f(g(x))}$$

First, we set $g(x) = a$, so $f(g(x))$ becomes $$f(g(x)) = f(a) = a + 5$$ Setting $f(a)$ equal to zero we get $a = -5$. Now we set $g(x)$ equal to $a = -5$ and solve for $x$:

$$g(x) = a$$ $$x^2 + 6x = -5$$ $$x^2 + 6x + 5 = 0$$ $$(x+1)(x+5) = 0$$ $$x = -1 \text{ or } x= -5$$

So we can calculate the value of $h(x)$ except for $x = -1$ or $x = -5$, where it is undefined.

Hope it helped you a bit. Please not that I'm not a professional mathematician, so please ask someone else too. The last thing I want is you getting a bad grade because of my answer (I'm not responsible for that. $:)$). If someone from the community notices something wrong or wants to add something, please edit this question. I would be thankful.

• Thank you for the correction! – Davis Rash Aug 17 '16 at 20:16
• @DavisRash No problem. :) Did this answer help you? – Kevin Aug 17 '16 at 21:01

I think the most thorough way to think about is this: under what circumstances can you multiply by the inverse of $x$?

This also works in cases when division isn't defined, but inverses exist (more advanced mathematical contexts like groups and matrices).