This is the equation that I use to calculate a percentage margin between cost and sales prices, where $x$ = sales price and $y$ = cost price:

\begin{equation} z=\frac{x-y}{x}*100 \end{equation}

This can be solved for $x$ to give the following equation, which calculates sales price based on cost price and margin percentage:

\begin{equation} x=\frac{y}{1-(\frac{z}{100})} \end{equation}

My question is, what are the steps involved in solving the first equation for $x$? It's been 11 years since I last did algebra at school and I can't seem to figure it out.

I'm guessing the first step is to divide both sides by $100$ like so:

\begin{equation} \frac{z}{100}=\frac{x-y}{x} \end{equation}

Then what? Do I multiply both sides by $x$? If so how to I reduce the equation down to a single $x$?

  • 2
    $\begingroup$ I think your problem is you don't remember that $\frac{a+b}{c} = \frac{a}{c} + \frac{b}{c}$. You can use that on $\frac{x-y}{x}$ and you'll find $\frac{x}{x}-\frac{y}{x}$. Unless $x=0$ this simplifies to $1 - \frac{y}{x}$. (In fact, it does too when $x=0$, then both equations are simply not defined. But you shouldn't worry about that too much.) $\endgroup$
    – Myself
    Feb 17, 2011 at 21:40

3 Answers 3


First, clear the denominator by multiplying both sides by $x$: \begin{align*} z &= \frac{100(x-y)}{x}\\ zx &= 100(x-y) \end{align*} Then move all the terms that have an $x$ in it to one side of the equation, all other terms to the other side, and factor out the $x$: \begin{align*} zx &= 100x - 100y\\ zx - 100x &= -100y\\ x(z-100) &= -100y \end{align*} Now divide through by $z-100$ to solve for $x$; you have to worry about dividing by $0$, but in order for $z-100$ to be $0$, you need $z=100$; the only way for $z$ to be equal to $100$ is if $\frac{x-y}{x}=1$, that is, if $x-y=x$, that is, if $y=0$. Since, presumably, you don't get the things for free, you can assume that $y\neq 0$ so this division is valid. You get: $$x = \frac{-100y}{z-100}.$$ Now, to get it into nicer form, use the minus sign in the numerator to change the denominator from $z-100$ to $100-z$. Then divide both the numerator and the denominator by $100$ to get it into the form you have: \begin{align*} x & = \frac{-100y}{z-100}\\ x &= \frac{100y}{100-z}\\ x &= \frac{\frac{1}{100}\left(100 y\right)}{\frac{1}{100}(100-z)}\\ x &= \frac{y}{1 - \frac{z}{100}}. \end{align*}

Added: Alternatively, following Myself's very good point, you can go "unsimplify" $\frac{x-y}{x}$ to $1 - \frac{y}{x}$, to go from $$\frac{z}{100} = \frac{x-y}{x} = 1 - \frac{y}{x}$$ to $$\frac{y}{x} = 1 - \frac{z}{100}.$$ Taking reciprocals and multiplying through by $y$ gives \begin{align*} \frac{x}{y} = \frac{1}{1 - \frac{z}{100}}\\ x = \frac{y}{1-\frac{z}{100}} \end{align*} which is probably how the particular expression you had (as opposed to $\frac{100y}{100-z}$) arose in the first place.

  • $\begingroup$ Great answer, really well explained thanks! $\endgroup$ Feb 18, 2011 at 9:33

$$ z = 100 \cdot \frac{x-y}{x}$$

$$ zx = 100(x-y)$$

$$zx - 100x = -100y$$

$$x(z-100) = -100y$$

$$x = -\frac{100y}{z-100}$$

Then divide both numerator and denominator by $-100$ to get $$x = \frac{y}{1-(\frac{z}{100})}$$


If you multiply an $x$ to each side, you will end up with $$ x \Big(\frac{z}{100}\Big) = x - y $$

However, an $ x $ still appears on both the left and right sides of the above equation. Reduce $ \frac{x -y}{x} $ to a single variable $ x $ by rewriting that expression as $$ \frac{x -y}{x} = \frac{x}{x} - \frac{y}{x} = 1 - \frac{y}{x} $$

Thus, $$ \frac{z}{100} = 1 - \frac{y}{x} $$

You may proceed accordingly to solve for $x$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .