I'm trying to solve it. Whatever it is, it's been out of my (very basic) understanding level thus far. Hahaha I have sheets and sheets of paper trying to work it out. I dunno if it helps, but it's an optimization problem, I'm trying to work out for a piece of software I'm writing. The 'original' equation looks like this...

$\frac{2y}{2 + x} = n$

And I want to see if I'm able to feed in any particular number to N, and solve for the x and y. Like this...

$\frac{2y}{2 + x} = 4148$

At first I tried solving for X and Y like this.(I don't know how to show the steps, so I'm just going to show the 'results'.

$y = 2074 + 1037x$

$x = \frac{8296}{y -1}$

Then I thought I could replace one side with the other.

$x = \frac{8296}{2073 + 1037x}$

But I think that led down the road to madness. And I came here straight away. I think I'm okay. But could someone perhaps shine a bit of light upon my situation?

What I mean by this...is I keep getting different answers, which makes me think I'm really doing it wrong. Also, and maybe this doesn't matter, but x and y are a constant product formula themselves. So, x * y will always equal k(the invariant). I super appreciate any thoughts! Thanks =)

  • $\begingroup$ You cannot solve a single such equation in two variables. $\endgroup$ Dec 7, 2020 at 20:54
  • $\begingroup$ If $xy=k$ is known, then you must use that fact. Write $y=k/x$ and substitute for $y$ in your equation. Then you should be able to solve for $x$ and $y$ in terms of $n$ and $k$. $\endgroup$
    – saulspatz
    Dec 7, 2020 at 21:00
  • 3
    $\begingroup$ Are you looking only for solutions where $x$ and $y$ are integers, or could $x$ and $y$ be fractional? $\endgroup$
    – MJD
    Dec 7, 2020 at 21:04
  • $\begingroup$ Indeed, Thanks for noting, @saulspatz. $\endgroup$
    – amWhy
    Dec 7, 2020 at 21:08
  • $\begingroup$ Can you tell us what $k$ is for this equation? $\endgroup$
    – PM 2Ring
    Dec 7, 2020 at 22:00

3 Answers 3


First of all, I am mystified why anyone would downvote the original query. The OP clearly showed work. Personally, I upvoted because of the shown work.

$\frac{2y}{2 + x} = n$

As others have indicated, this equation (by itself) can not be completely solved. As Yves Daoust's answer indicates, if an additional equation is added, such as

$$xy = k ~: ~\text{with} ~k~ \text{a known value}$$

then, the equation can be completely solved.

Focusing only on the equation explicitly provided in the query:

$$\frac{2y}{2 + x} = n$$

The most that you can do is as follows:

$${2y} = n(2 + x) \implies y = \frac{n(2+x)}{2}.$$

What this partial solution signifies is that if $x$ is any known value, then $y$ can be computed. An alternative explanation is that $y$ has been expressed as a function of $x$.

In a similar fashion a typical equation for a line might be

$$y = mx + b. \tag{1}$$

This equation would signify that a point $(x,y)$ is on the line if and only if equation (1) above is satisfied.

Per OP's request.

Any chance you could walk through solving it if K is a known value? (which it is) Yves' answer seems to work for me, but I have no idea how to replicate it.

It is very difficult to add anything to Yves Daoust's answer. Each step that he took was accurate, valid, and clear. The best that I can do is walk you through it, one step at a time, providing explanation for why a specific step is taken, and (perhaps) extra detail on why the step is valid.

Assume that you are trying to solve the system:

$$\begin{cases}\dfrac{2y}{2+x}=n,\\xy=k,\end{cases}$$ where $n$ and $k$ are given.

Note: as indicated in Yves Daoust's answer, $(x = -2)$ is outlawed, because it would make the denominator in the first equation $0$.

The first question to ask is: what is your goal?

  1. Do you want to know how to apply Yves Daoust's answer to a specific value for $n$ and $k$?
  2. Do you want to be able to attack similar problems that will have somewhat different answers?

I will take these questions one at a time. For the first question, as I understand it, you understand and agree with his work, and therefore accept that the answer is


Suppose that (for example) $[n = 10~$ and $~k = 15]$.

Then, the values for $y$ that satisfy the quadratic are

$$y ~=~ \frac{(10)\pm\sqrt{(10)^2+2(15)(10)}}{2} ~=~ \frac{10 \pm \sqrt{400}}{2} ~=~ \frac{10 \pm 20}{2} ~=~ (5 \pm 10).$$

First, the meaning of this result should be clarified. By creating and solving a quadratic, the inference is that for any value of $(x,y)$ that solves the original equation, $y$ will have to be an element of $\{15,-5\}.$

This doesn't mean that each (or any) of the values of $y$ in $\{15, -5\}$ will necessarily generate an $(x,y)$ solution that satisfies both of the original equations. What it does mean is that no other value for $y$ can work.

Therefore, what is required is to examine each candidate value of $y$, compute $x$ based on one of the two original equations, and then check to see whether that $(x,y)$ pairing satisfies the other original equation.

When $y = 15$ and $k = 15$, the second equation gives $x = 1$. Checking the $(x,y)$ pair against the first equation asserts that

$$\frac{2[15]}{2+[1]}=10~: ~\text{this is true}.$$

Therefore, $y=15$ does lead to a satisfying solution.

When $y = (-5)$ and $k = 15$, the second equation gives $x = (-3)$. Checking the $(x,y)$ pair against the first equation asserts that

$$\frac{2[-5]}{2+[-3]}=10~: ~\text{this is true}.$$

Therefore, the second value of $(y = -5)$ also leads to a solution: $(x,y) = (-3, -5).$ By all of the analysis so far, both solutions $(1,15)$ and $(-3,-5)$ are each solutions to both of the original equations.

Therefore, as far as the first question is concerned, you can use the above procedure against any given values of $n$ and $k$ to find all possible solutions (if any). Note that any solution that results in $(x = -2)$ is outlawed, as previously mentioned.

Now, I will attack the second question.

First, start with the first original equation:


The first goal should be to clear the denominator, which is exactly what Yves Daoust did:

$$2y = 2n + nx \implies $$

$$2y-nx-2n=0. \tag{2}$$

Now, you have a major difficulty. Once your intuition is developed, you will realize that you can not completely solve the equation without using both of the original equations (i.e. also using the second original equation).

However, the equation (2) above does not have an $(xy)$ term. Let's be clear on what your goal is at this point. $x$ and $y$ are variables, and $n$ and $k$ are known values. Therefore, you want to solve for each of $x$ and $y$ in terms of $n$ and $k$.

What this means, at this point, is that equation (2) above must be altered so that the second (original) equation $(xy = k)$ can be applied.

There are only way two possible ways to do this:

  • multiply equation (2) by $x$, so that the first LHS term becomes $(2xy)$.

  • multiply equation (2) by $y$, so that the second LHS term becomes $(nxy)$.

Yves Daoust chose the second method, so let's follow his logic. Equation (2) becomes

$$2y^2 - n(xy) - 2ny = 0. \tag{3}$$

At this point, you have succeeded in taking the only term in equation (2) that had a factor of $x$ and converting it into a factor of $(xy)$. The motivation for this was because the second original equation is $(xy) = k$.

Now, the second original equation may be utilized, and equation (3) becomes

$$2y^2 - n(k) - 2ny = 0. \tag{4}$$

Examining equation (4) above, $x$ has been eliminated, so that the only variable is $y$. Further, the first term in equation (4) is $(2y^2)$. Therefore, you have a quadratic equation in $y$. Therefore, the next step is to rearrange the terms to clarify the quadratic.

$$y^2(2) + y(-2n) + (-nk) = 0. \tag{5}$$

Since the quadratic equation $Ax^2 + Bx + C = 0$ is solved by $x = \frac{1}{2A} \times \left(-B \pm \sqrt{B^2 - 4AC}\right)$, equation (5) is solved by

$$y ~=~ \frac{1}{4} \times \left(2n \pm \sqrt{4n^2 + 8nk}\right) ~=~ \frac{1}{2} \times \left(n \pm \sqrt{n^2 + 2nk}\right). \tag{6}$$

Notice that this analysis exactly matches Yves Daoust's analysis.

The remaining steps are to consider each value of $y$ that satisfies the quadratic equation separately. For each value of $y$, a value of $x$ will be generated by the equation $(xy = k).$ This will result in a candidate value for $(x,y)$ that may or may not satisfy the first original equation. Your solution will then be each value of $(x,y)$ that satisfies both equations, where $x$ is not allowed to $= -2.$

If $y = \frac{1}{2} \times \left(n + \sqrt{n^2 + 2nk}\right),$ then

$$x ~=~ \frac{k}{y} ~=~ \frac{2k}{n + \sqrt{n^2 + 2nk}}.$$

Here, the denominator needs to be cleared. This is done by multiplying the RHS fraction by $\frac{n - \sqrt{n^2 + 2nk}}{n - \sqrt{n^2 + 2nk}}.$

This gives

$$x = 2k \times \frac{n - \sqrt{n^2 + 2nk}}{(-2nk)} ~=~ \frac{\sqrt{n^2 + 2nk} ~-~ n}{n}.$$


$$(x,y) ~=~ \left(\frac{\sqrt{n^2 + 2nk} ~-~ n}{n} ~,~ \frac{n + \sqrt{n^2 + 2nk}}{2} \right) \tag{7}$$

must be checked against


$$\frac{2y}{2+x} ~=~ \frac{n + \sqrt{n^2 + 2nk}} {2 + \frac{\sqrt{n^2 + 2nk} ~-~ n}{n}} ~=~ \frac{n + \sqrt{n^2 + 2nk}} {\frac{n + \sqrt{n^2 + 2nk}}{n}} ~=~ n.$$

Therefore, the candidate value identified in equation (7) satisfies both of the equations and is therefore a solution.

Now, the remaining candidate value must be checked.

If $y = \frac{1}{2} \times \left(n - \sqrt{n^2 + 2nk}\right),$ then

$$x ~=~ \frac{k}{y} ~=~ \frac{2k}{n - \sqrt{n^2 + 2nk}}.$$

Here, the denominator needs to be cleared. This is done by multiplying the RHS fraction by $\frac{n + \sqrt{n^2 + 2nk}}{n + \sqrt{n^2 + 2nk}}.$

This gives

$$x = 2k \times \frac{n + \sqrt{n^2 + 2nk}}{(-2nk)} ~=~ - \frac{n ~+~ \sqrt{n^2 + 2nk}}{n}.$$


$$(x,y) ~=~ \left(- \frac{n ~+~ \sqrt{n^2 + 2nk}}{n} ~,~ \frac{n - \sqrt{n^2 + 2nk}}{2} \right) \tag{8}$$

must be checked against


$$\frac{2y}{2+x} ~=~ \frac{n - \sqrt{n^2 + 2nk}} {2 - \frac{n ~+~ \sqrt{n^2 + 2nk}}{n}} ~=~ \frac{n - \sqrt{n^2 + 2nk}} {\frac{n - \sqrt{n^2 + 2nk}}{n}} ~=~ n.$$

Therefore, the candidate value identified in equation (8) also satisfies both of the equations and is therefore also a solution.

Note, that if this analyis (i.e. the Addendum's 2nd question) had been tackled before the Addendum's 1st question, then you could have reasoned as follows (re the specific example $n=10, k=15$).

From the above analysis, regardless of the values of $n$ and $k$ both of the solutions generated by $y = \frac{n \pm \sqrt{n^2 + 2nk}}{2}$ will result in an $(x,y)$ pair that satisfies both equations, assuming that the outlawed value of $(x = -2)$ is not generated. Therefore, you could reason that the values of $(x,y) = (1,15)$ and $(x,y) = (-3,-5)$ must both satisfy both of the original equations.

  • $\begingroup$ Any chance you could walk through solving it if K is a known value? (which it is) Yves' answer seems to work for me, but I have no idea how to replicate it. $\endgroup$ Dec 8, 2020 at 2:22
  • $\begingroup$ @JaredSmith I just added an Addendum to my answer. $\endgroup$ Dec 8, 2020 at 5:46
  • $\begingroup$ Wow!!! Thankyou very kindly, this is exactly the level of dummy explanation I was looking for =) I am able to follow you until the work shown after equation 7. Beneath the 'Must be checked against 2y / (2 + x) = n heading. I maybe don't understand how we're checking them against each other? Definitely giving you the answer here, I really appreciate you taking the time to walk me through it so thoroughly! $\endgroup$ Dec 8, 2020 at 21:51
  • $\begingroup$ @JaredSmith Each candidate value $(x,y)$ must be manually checked to see if it satisfies (1) $~\frac{2y}{2+x} = n~$ and (2) $~(xy) = k.~$ The general procedure that I used from this point to the end of the addendum was to take each solution $y$ that satisfied the quadratic, and use equation (2) $[(xy) = k]$ to compute the corresponding candidate value $x$. Because of this approach, all that remained was to check whether the candidate value $(x,y)$ satisfied equation (1) $~\frac{2y}{2+x} = n.~$ Therefore, that is exactly what I did following both of the equations tagged (7) and (8). $\endgroup$ Dec 8, 2020 at 22:15
  • $\begingroup$ Thankyou!! You're a god among men and women, and an excellent teacher =) much appreciated, I didn't ever imagine I would get such a thorough and solid piece of help to my little numerical struggle! @user2661923, Do you have any suggestions for how I might rename this question to help future people better find what they're looking for? The current title seems pretty useless. $\endgroup$ Dec 10, 2020 at 16:10

It's unclear (to me at least) how you got from ${2y\over2+x}=4148$ to either $y=2074+1037x$ or $x={8296\over y-1}$, neither of which is correct, but here are simple algebraic steps that lead to correct equations:

$${2y\over2+x}=4148\implies{y\over2+x}=2074\implies y=2074(2+x)\implies y=4148+2074x$$


$${2y\over2+x}=4148\implies{y\over2+x}=2074\implies{2+x\over y}={1\over2074}\implies2+x={y\over2074}\\\implies x={y\over2074}-2$$

If you like, the equation for $x$ in terms of $y$ can be written as $x={y-4148\over2074}$.

Finally, in answer to the question in the title, because ${2y\over2+x}=n$ implies $y={n\over2}x+n$, it is, in essence, a disguised version of a linear equation. The name derives from the fact that the solution set, plotted in the $xy$-plane, consists of points on a line. (Technically the point $(-2,0)$ is not in the solution set since $2y/(2+x)$ is not defined when $2+x=0$. This is reflected in the use the implication symbol $\implies$, rather than the if-and-only-if symbol $\iff$.)


There are many $(x,y)$ pairs that will solve your equation:

  • $x=0, y=4148$
  • $x=1, y=6222$
  • $x=2, y=8296$

In fact, there is a matching $y$ for any real number $x$ as long as $x \ne -2$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.