Mary has a total of $5000 invested in two accounts. One account pays 5% and the other 8%. Her interest in the first year was $331. Write and solve a system of equations to find out how much she has invested in both accounts.

amount invested at 5% --- x

amount invested at 8% --- y

x+y = 5000
(5/100)x + (8/100)y = 331
times 100
5x + 8y = 33100
first equation times 5
5x + 5y = 25000
subtract them:
3y = 8100
y = 2700
take over....

2300

To solve this problem, we can set up a system of equations based on the given information. Let's assume Mary invested x dollars in the account paying 5% interest and y dollars in the account paying 8% interest.

The first equation represents the total amount invested:

x + y = 5000 ------------------- Equation 1

The second equation represents the total interest earned in the first year:

0.05x + 0.08y = 331 ------- Equation 2

Now, we can solve this system of equations.

We can begin by solving Equation 1 for x:

x = 5000 - y

Next, substitute this value of x into Equation 2:

0.05(5000 - y) + 0.08y = 331

Now, simplify the equation:

250 - 0.05y + 0.08y = 331
250 + 0.03y = 331
0.03y = 331 - 250
0.03y = 81

Finally, solve for y:

y = 81 / 0.03
y = 2700

Substitute the value of y back into Equation 1 to find the value of x:

x + 2700 = 5000
x = 5000 - 2700
x = 2300

So, Mary has invested $2300 in the account paying 5% interest and $2700 in the account paying 8% interest.