Let us say that A and B represent the money invested in accounts A and B, respectively.
Then, if Mary invested $12 000 in total:
![A+B=12000...(1)](https://img.qammunity.org/2023/formulas/mathematics/college/hjazgeguxwwtj9hhrhxmdbdu8ip65j6sjc.png)
The formula for the simple interest is given by the equation:
![I=r\cdot P\cdot t](https://img.qammunity.org/2023/formulas/mathematics/college/cl2rvpdn39cjfpaa3tq7zx53zvh9x0pcxr.png)
Where r is the annual rate of interest and t is the time (in years).
From the problem, we identify:
![\begin{gathered} r_A=0.12 \\ r_B=0.08 \\ t=1 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/s4g5b0zkc6p3j4hqjyb2v4lp82ulldk25q.png)
Then, the interests at the end of 1 year for each account are:
![\begin{gathered} I_A=0.12A \\ I_B=0.08B \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/bvphoqoitbpwk4kladq73foryuk3ypqmk4.png)
If the total interest is $1240:
![\begin{gathered} I_A+I_B=1240 \\ \\ \Rightarrow0.12A+0.08B=1240...(2) \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/rctxf7t7tjr96ilkebo206owrywr105g19.png)
From (1):
![B=12000-A...(3)](https://img.qammunity.org/2023/formulas/mathematics/college/mgqo1clnqa5twqps0se5tp2bewssuz8v6w.png)
Using (3) in (2):
![\begin{gathered} 0.12A+0.08\left(12000-A\right)=1240 \\ \\ 0.12A+960-0.08A=1240 \\ \\ 0.04A=280 \\ \\ \Rightarrow A=\$7000\text{ \lparen Money invested in account A\rparen} \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/sr6fkpb2t4qfu0c2hmk53bjjftg9ebv2s5.png)
Finally, using this result on (3):
![\begin{gathered} B=12000-7000 \\ \\ \Rightarrow B=\$5000\text{ \lparen Money invested in account B\rparen} \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/f122cz5ljn8n3fyphx0xkqsmk8vw2swmbm.png)