Let the investment in first account be x and this account is earning 3.5% interest
So Interest on this account is 3.5% of x = 0.035x
So the investment in second account would be (1,000,000-x) and this account is earning 4.5% interest
So the interest on this account is 4.5% of (1,000,000-x) = 0.045*(1,000,000-x)
Given that total interest for the year is $42,000
So we have
0.035x + 0.045(1,000,000-x) = 42,000
0.035x - 0.045x + 0.045*1,000,000 = 42,000
-0.01x + 45,000 = 42,000
-0.01x = 42,000-45,000
-0.01x = - 3000
0.01x = 3000
x = 3000/0.01
x= 3,00,000
Therefore Investment in one account s 300,000 and the investment in other account is 1,000,000-300,000 = 700,000