Solve for \(y(x)\) given \(\dfrac{dy}{dx}=3y+1\) and \(y(0)=1\).
Rearrange the differential equation so that the \(y\) terms and \(dy\) are on one side, and the \(x\) terms and \(dx\) are on the other side.
\[\begin{align*} \frac{dy}{dx} & = 3y+1\\
\frac{1}{3y+1}\frac{dy}{dx} & = 1\\
\frac{1}{3+1}dy & = 1dx
\end{align*}\]
Now that we have separated the variables, we can integrate each side separately.
\[\int\frac{1}{3y+1}dy = \int1dx\]
For the left side, we have to use the substitution rule. We let \(u=3y+1\), so \(\dfrac{du}{dy}=3\) and \(dy=\dfrac{dy}{3}\).
\[\begin{align*} \int\frac{1}{3y+1}dy & = \int1dx\\
\int\frac{1}{u}\frac{du}{3} & = \int1dx\\
\frac{1}{3}\ln(u) & = x+c\\
\ln(u) & = 3(x+c)\\
\ln(u) & = 3x+3c\\
\ln(3y+1) & = 3x+3c\\
3y+1 & = e^{3x+3c}\\
& = e^{3x}e^{3c}\\
y & = \frac{1}{3}(e^{3x}e^{3c}-1)\\
& = \frac{1}{3}e^{3x}e^{3c}-\frac{1}{3}\\
& = Ae^{3x}-\frac{1}{3}
\end{align*}\]
where \(A=\dfrac{1}{3}e^{3c}\).
We know that \(y(0)=1\), so we can solve for \(A\).
\[\begin{align*} 1 & = Ae^{3\times0}-\frac{1}{3}\\
A & = \frac{4}{3}
\end{align*}\]
Putting this altogether:
\[y(x)=\frac{4}{3}e^{3x}-\frac{1}{3}\]