Let's denote the amount invested in the account yielding 7% simple interest as \(x\) dollars and the amount invested in the account yielding 6.5% simple interest as \(40000 - x\) dollars (since the total inheritance is $40,000).
The interest earned from the first account (\(7\%\) interest rate) is \(0.07x\) dollars.
The interest earned from the second account (\(6.5\%\) interest rate) is \(0.065(40000 - x)\) dollars.
We know that the total interest earned from both accounts is $2,640.
So, we can write the equation:
\[ 0.07x + 0.065(40000 - x) = 2640 \]
Let's solve for \(x\):
\[ 0.07x + 0.065(40000 - x) = 2640 \]
\[ 0.07x + 2600 - 0.065x = 2640 \]
\[ 0.005x = 40 \]
\[ x = \frac{40}{0.005} \]
\[ x = 8000 \]
So, you should invest $8,000 in the account yielding 7% simple interest, and the remaining amount, $32,000, in the account yielding 6.5% simple interest.