Answer
The amount invested in stock $1$ is $\$2600$, and the amount invested in stock $2$ is $\$1400$.
Work Step by Step
Let us assume the amount invested in stock $1$ is $\$ x $.
Thus, the amount invested in stock $2$ is $\$\left(4000-x\right)$.
Stock $1$ pays $12$% interest per year, that is, $0.12x $ per year.
Stock $2$ pays 14% interest per year, that is, $0.14\left( 4000-x \right)$ per year.
Here, the total interest given is $\$508$:
$\begin{align}
& 0.12x+0.14\left( 4000-x \right)=508 \\
& 0.12x+560-0.14x=508
\end{align}$
Subtract $560$ from both sides and obtain:
$\begin{align}
& 0.12x+560+0.14x-560=508-560 \\
& -0.02x=-52
\end{align}$
Multiply both sides by $-1$:
$0.02x=52$
Divide by $0.02$:
$\begin{align}
& x=\frac{52}{0.02} \\
& =2600
\end{align}$
Thus, the amount invested in stock $1$ is $\$2600$, and the amount invested in stock $2$ is $\left( 4000-2600 \right)=\$1400$.