Let the principal between the two accounts be x and y
x = principal invested at 6%
y = principal invested at 8%
7000 was invested in the two accounts.
Principal

Interest

Solving equations (1) and (2) simultaneously,

Substituting y in equation (1) to get the value of x

Therefore, the principal invested at 6% is 4000 and the principal invested at 8% is 3000.