Keith and Shawn each have some money. If Keith spends $38, the ratio of the amount of money Keith has to the amount of money Shawn has will become 2:5. If Shawn spends $38, the ratio will become 8:13. How much money does each boy have?

Keith's amount --- k

Shawn's amount --- s

(k-38)/s = 2/5
5k - 190 = 2s
5k - 2s = 190 (#1)

k/(s-38) = 8/13
13k = 8s - 304
13k - 8s = -304 (#2)

4(#1) - #2 ----> 7k = 1064
k = 152
back in #1
5(152) - 2s = 190
s = 570

Keith had $152 , Shawn had $570

To solve this problem, let's set up a system of equations.

Let's say Keith has K dollars, and Shawn has S dollars.

According to the given information, if Keith spends $38, the ratio of Keith's money to Shawn's money becomes 2:5. This can be expressed as:

(K - 38) / S = 2/5

Similarly, if Shawn spends $38, the ratio becomes 8:13:

K / (S - 38) = 8/13

We now have a system of two equations:

1) (K - 38) / S = 2/5
2) K / (S - 38) = 8/13

To solve this system, we'll use the method of substitution:

From equation 1, we can rewrite it as:

5(K - 38) = 2S ---> Equation 3

From equation 2, we can rewrite it as:

13K = 8(S - 38) ---> Equation 4

Now, let's solve equations 3 and 4 simultaneously to find the values of K and S.

Expanding equation 3, we get:
5K - 190 = 2S

Rearranging the terms, we have:
5K - 2S = 190 ---> Equation 5

Expanding equation 4, we get:
13K = 8S - 8 * 38

Simplifying, we have:
13K = 8S - 304 ---> Equation 6

Now, we have a system of linear equations:

5K - 2S = 190 ---> Equation 5
13K - 8S = -304 ---> Equation 6

To solve this system, we can multiply equation 5 by 8 and equation 6 by 2 to eliminate the S term:

40K - 16S = 1520 ---> Equation 7 (multiplied equation 5 by 8)
26K - 16S = -608 ---> Equation 8 (multiplied equation 6 by 2)

Now, subtract equation 8 from equation 7 to eliminate the S term:

40K - 26K = 1520 + 608
14K = 2128

Divide both sides by 14:
K = 2128 / 14
K = 152

Now, substitute the value of K into equation 4:

13(152) = 8S - 304

1976 = 8S - 304

Add 304 to both sides:
8S = 2280

Divide both sides by 8:
S = 285

Therefore, Keith has $152, and Shawn has $285.