Tom and Peter have some money. The price of game cartridge is $45. If Tom buys this game cartridge, the ratio of his money left to that of Peter's will be 1:3. However, if Peter buys the game cartridge, the ratio of his money left to that of Tom's is 3:5. How much money does each boy have at first?

Let's assume that Tom has x dollars and Peter has y dollars at first.

According to the problem, if Tom buys the game cartridge, he will have x-45 dollars left, and Peter will have y dollars left. The ratio of Tom's money left to Peter's money left is given as 1:3. Therefore, we can write:

(x-45) / y = 1/3 ---- (1)

Similarly, if Peter buys the game cartridge, he will have y-45 dollars left, and Tom will have x dollars left. The ratio of Peter's money left to Tom's money left is given as 3:5. Therefore, we can write:

(y-45) / x = 3/5 ---- (2)

We now have two equations with two variables. We can solve for x and y using these equations.

Multiplying equation (1) by 3, we get:

3(x-45) / y = 1

Simplifying, we get:

3x - 135 = y ---- (3)

Multiplying equation (2) by x, we get:

x(y-45) / x = 3/5

Simplifying, we get:

y - 45 = (3/5)x

y = (3/5)x + 45 ---- (4)

We can substitute equation (3) into equation (4) to get:

3x - 135 = (3/5)x + 45

Multiplying both sides by 5, we get:

15x - 675 = 3x + 225

Simplifying, we get:

12x = 900

x = 75

Substituting x = 75 into equation (3), we get:

3(75) - 135 = y

y = 90

Therefore, Tom had $75 at first, and Peter had $90 at first.

Ans: Tom had $75 at first, and Peter had $90 at first.