# Solving problem with a middle number between 2 numbers

#### Java9999

##### New member
Hi guys,
I have a question relating to finding a middle number between 2 numbers as followed:
You're given 2 numbers A and B and 2 other numbers X and Y
The objective is to find number C so that A+/- x=C And
B +/- y = C (condition is B<C<A or C is always between A and B)

The rule for x and y is: x could be X or x could be a number < X
y could be Y or y could be a number < Y
x or y can be multiplied by 2, 4 however only one of them multiplied at the time

Example : A = 9, B = 13.5, X = 0.375, Y=3.1875, the result C is 10.6875

However I play with the guessing like this: with Y = 3.1875, y could be 3.1875 (1.5 + 1.5 +0.1875) so I assign y = 1.5 + 0.1875 =1.6875 then 1.6875 + 9 = 10.6875
13.5 - 3.1875 + 0.375 = 10.6875

The problem is that it took a lot of guessing and playing around with those numbers AND there could other missing result as well, 10.6875 is NOT the only result. I'm wondering if there is a FORMULA or equation or function to solve this problem, I really appreciate anyone help me with this!

#### Subhotosh Khan

##### Super Moderator
Staff member
Hi guys,
I have a question relating to finding a middle number between 2 numbers as followed:
You're given 2 numbers A and B and 2 other numbers X and Y
The objective is to find number C so that A+/- x=C And
B +/- y = C (condition is B<C<A or C is always between A and B)

The rule for x and y is: x could be X or x could be a number < X
y could be Y or y could be a number < Y
x or y can be multiplied by 2, 4 however only one of them multiplied at the time

Example : A = 9, B = 13.5, X = 0.375, Y=3.1875, the result C is 10.6875

However I play with the guessing like this: with Y = 3.1875, y could be 3.1875 (1.5 + 1.5 +0.1875) so I assign y = 1.5 + 0.1875 =1.6875 then 1.6875 + 9 = 10.6875
13.5 - 3.1875 + 0.375 = 10.6875

The problem is that it took a lot of guessing and playing around with those numbers AND there could other missing result as well, 10.6875 is NOT the only result. I'm wondering if there is a FORMULA or equation or function to solve this problem, I really appreciate anyone help me with this!
Please explain the difference between x and X

If those are same variable - write those as same variable. If those are different variable - write those as completely different variable (e.g. x and W)

Similarly:

Please explain the difference between y and Y.

If those are same variable - write those as same variable. If those are different variable - write those as completely different variable (e.g. y and P)

Please correct your post and re-post.

#### Java9999

##### New member
Hi Khan,
I think I already explain about x and y, x could be X and y could be Y, x and y also could be any number < X, Y
The reason I have x and y is because A +/- X is NOT EQUAL B +/- Y so I have x and y as extra variable that DERIVED FROM X, Y
For example in the above example Y = 3.1875 and A +Y = 9 + 3.1875 = 12.1875 > 10.6875 so I create y =1.5 + 0.1875 =1.6875 (which is part of Y) so that A + y= 9 + 1.6875 = 10.6875
Please let me know if it is clear. Thanks

Please explain the difference between x and X

If those are same variable - write those as same variable. If those are different variable - write those as completely different variable (e.g. x and W)

Similarly:

Please explain the difference between y and Y.

If those are same variable - write those as same variable. If those are different variable - write those as completely different variable (e.g. y and P)

Please correct your post and re-post.

#### Dr.Peterson

##### Elite Member
I can't tell where 1.5 fits into your description of the problem. It isn't either x or y, yet you appear to be doubling it. This is not at all clear yet.

It appears, though, that you have a number of choices, involving doubling or quadrupling x or y. There is no way a mere formula could make such a choice for you. But perhaps there could be a formula containing an arbitrary multiplier, for which you would have to try various values, or whose value could be determined by some preliminary calculation.

Possibly if you explained the real situation that you are trying to solve, it would be easier to understand.

#### Java9999

##### New member
Thanks Dr Peterson

#### pka

##### Elite Member
I have a question relating to finding a middle number between 2 numbers as followed:
You're given 2 numbers A and B and 2 other numbers X and Y
The objective is to find number C so that A+/- x=C And B +/- y = C (condition is B<C<A or C is always between A and B)
Hello, Java9999, I did try to post a reply because I did not and still do understand the question.
But here is a related question: If $$\displaystyle A~\&~B$$ are two numbers then there is a number $$\displaystyle C$$ between $$\displaystyle A~\&~B$$.
Let's think about the implications of that statement. First, betweeness is a property of ordered sets so we are using real numbers,
If we can prove the statement then what appears to be a common sense statement has powerful consequences.
For example: if for any two real numbers $$\displaystyle x<y$$ then $$\displaystyle (x,y)=\{t\in\mathbb{R}: x<t<y\}\ne\emptyset$$.
PROOF
1) If $$\displaystyle x<y$$ then $$\displaystyle \frac{x}{2}<\frac{y}{2}$$, multiply by one-half.
2) Moreover, $$\displaystyle x=\left(\frac{x}{2}+\frac{x}{2}\right)<\frac{y}{2}+\frac{x}{2}$$, add half $$\displaystyle x$$ to both sides if #1.
3) Likewise, $$\displaystyle \left(\frac{y}{2}+\frac{x}{2}\right)<\frac{y}{2}+\frac{y}{2}=y$$
4) Hence, $$\displaystyle x<\left(\frac{x+y}{2}\right)<y$$
Simply put: between any two real numbers there is a third number.
If one thinks of the myriad of applications of this, one stands out: every open interval of reals must contain infinity many numbers.

#### Cubist

##### Junior Member
@Java9999 Can you give some more examples of possible C values (but keep A,B,X,Y the same)?

I'm guessing that you might be after this formula for possible y values...
y=floor(Y)/w + Y - floor(Y)
where w is {1,2,4} and "floor" means "return the next lowest integer". If you are using a spreadsheet then...
=ROUNDDOWN(Y)/w + Y - ROUNDDOWN(Y)

if w=1, then you get y=3.1875, if w=2 then y=1.6875 and w=4 then y=0.9375

--

Note that in your example the condition x ≤ X is not met...
x = X-C = 13.5-10.6875 = 2.8125 but X = 0.375
So I assume that only one of x <= X and y<=Y must be true?