Person A has one amount of money in his pocket, Person B has one amount of money in his pocket. If person A gives X amount to person B, person B will end up with 3 times more money than person A. However if person B gives the same amount X to person A, Person A will end up with double the amount of person B.

How much does each of the persons have in his pocket and what amount are they giving to each other?

(A-x)3 =B+x

3A - 3 x = B + x
4 x = 3A-B

(B - x)2 = A + x
2 B - 2x = A + x
3x = 2 B - A

12 x = 9 A - 3 B
12 x = 8 B - 4 A
---------------
0 = 13 A - 11 B
11 B = 13 A
a solution is
A = 11 and B = 13
then remember
3x = 2 B - A
3 x = 26 - 11 = 15
x = 5

multiples of those will also work though
like
A =22, B =26, x = 10

To solve this problem, let's use algebraic equations to represent the given information.

Let's assume that Person A has M amount of money in his pocket, and Person B has N amount of money in his pocket.

According to the first condition, if Person A gives X amount to Person B, Person B will end up with 3 times more money than Person A. So, after the exchange, Person B will have N + X and Person A will have M - X.

From this, we can write the equation: N + X = 3(M - X)

According to the second condition, if Person B gives X amount to Person A, Person A will end up with double the amount of Person B. So, after the second exchange, Person A will have M - X + X = M, and Person B will have N - X.

From this, we can write another equation: M = 2(N - X)

Now we have two equations with two unknowns. We can solve them simultaneously.

First, simplify the equations:

N + X = 3M - 3X
N - 3M = -4X

M = 2N - 2X

Now, let's eliminate X from the equations:

Multiply the second equation by 3:

3N - 9M = -12X

Add this to the first equation:

N + X + 3N - 9M = 3M - 3X - 12X

Combine like terms:

4N - 9M = -15X

Now substitute M with 2N - 2X from the third equation:

4N - 9(2N - 2X) = -15X

Simplify:

4N - 18N + 18X = -15X

Combine like terms again:

14X - 14N = 0

Divide both sides by 14:

X - N = 0

Now we have X = N.

Since X and N are equal, we can substitute one with the other in any of the equations. Let's use the second equation:

M = 2(N - X) = 2(0) = 0

Therefore, both Person A and Person B have 0 money in their pockets.

In conclusion, if Person A gives 0 amount of money to Person B, Person B will still have 0 money, and if Person B gives 0 amount of money to Person A, Person A will still have 0 money.