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.

Eq1: Po1+ Po2 = 5000

Po1*0.05*1 + Po2*0.08*1 = 331
0.05Po1 + 0.08Po2 = 331

Eq2: 5Po1 + 8Po2 = 33100
Multiply Eq1 by -5 and add Eq1 and Eq2:
-5Pol - 5Po2 = -25,000
+5Po1 + 8Po2 = 33,100
Sum: 3Po2 = 8100
Po2 = $2700
Pol = 5000-2700 = $2300.

To solve this problem, we can set up a system of equations based on the given information.

Let's represent the amount invested in the 5% account as 'x' dollars, and the amount invested in the 8% account as 'y' dollars.

According to the problem statement, Mary has a total of $5000 invested in both accounts, so we can write the first equation as:

x + y = 5000 (Equation 1)

Next, we know that Mary earned $331 in interest in the first year. The interest earned from the 5% account can be calculated as 5% of the amount invested in that account, which is 0.05x. Similarly, the interest earned from the 8% account can be calculated as 8% of the amount invested in that account, which is 0.08y. So, the second equation is:

0.05x + 0.08y = 331 (Equation 2)

Now we have a system of equations:

x + y = 5000 (Equation 1)
0.05x + 0.08y = 331 (Equation 2)

To solve this system of equations, we can use the method of substitution or elimination. Let's use the method of elimination to solve this system.

We can multiply Equation 1 by -0.05 and Equation 2 by 100 to eliminate the decimal coefficients of x:

-0.05(x + y) = -0.05(5000)
0.05x + 0.08y = 331

Simplifying, we get:

-0.05x - 0.05y = -250
0.05x + 0.08y = 331

Now, we can add both equations together:

(-0.05x - 0.05y) + (0.05x + 0.08y) = -250 + 331

Simplifying further, we have:

0.03y = 81

Dividing both sides by 0.03, we find:

y = 2700

Now, substitute the value of y into Equation 1 to find x:

x + 2700 = 5000

Subtracting 2700 from both sides, we get:

x = 2300

Therefore, Mary has $2300 invested in the 5% account and $2700 invested in the 8% account.