#### Answer

We can verify this by differentiating $y=-\cos x \ln|\sec x + \tan x|$ and putting $y$ and $y''$ into the differential equation $y''+4y'=2e^x$. This verifies the solution.

#### Work Step by Step

We will find the first and the second derivative of $y$:
$y' = (-\cos x \ln|\sec x + \tan x|)' = -(\cos x)'\ln|\sec x + \tan x|-\cos x(\ln|\sec x + \tan x|)'$
where we used the product rule. Now we have
$$(\cos x)' = -\sin x$$
from the table of derivative as well as
$$(\ln|\sec x + \tan x|)'=\frac{1}{|\sec x+\tan x|}(|\sec x+ \tan x|)'$$
where we used the chain rule.
Now $$(|\sec x+ \tan x|)'=\text{sign}(\sec x+ \tan x)(\sec x +\tan x)' =\text{sign}(\sec x+ \tan x) ((\sec x)' + (\tan x)') =\text{sign}(\sec x+ \tan x)\left(\frac{\sin x}{\cos^2 x} + \frac{1}{\cos^2 x}\right) = \text{sign}(\sec x+ \tan x) \frac{1+\sin x}{\cos^2 x}.$$
This helps us get
$$(\ln|\sec x + \tan x|)' = \frac{\text{sign}(\sec x+ \tan x)}{|\sec x+ \tan x|}\times\frac{1+\sin x}{\cos^2 x}.$$
Since the sign function gives values $\pm 1$ depending of the "sign" of its argulent (whether it is positive or negative) we now that $\text{sign} x = 1/\text{sign} x$ because $1/\pm1=\pm 1$. Putting this into previous expression:
$$(\ln|\sec x + \tan x|)' = \frac{\text{sign}(\sec x+ \tan x)}{|\sec x+ \tan x|}\times\frac{1+\sin x}{\cos^2 x} =\frac{1}{\text{sign}(\sec x+ \tan x)|\sec x+ \tan x|}\times\frac{1+\sin x}{\cos^2 x} = \frac{1}{\sec x+ \tan x}\frac{1+\sin x}{\cos ^2 x} = \frac{1+\sin x}{\cos^2 x \frac{1}{\cos x} + \cos^2 x\frac{\sin x}{\cos x}}=\frac{1+\sin x}{\cos x (1+\sin x)} = \frac{1}{\cos x}.$$
Assembling these results into the expression for $y'$ we get
$$y' = \sin x \ln|\sec x +\tan x|-\cos x\frac{1}{\cos x} =\sin x \ln|\sec x +\tan x|-1. $$
Now let us find the second derivative:
$$y''=(y')' = (\sin x \ln|\sec x +\tan x|-1)' = (\sin x \ln|\sec x +\tan x|)' - (1)'.$$
The derivative of a constrant $(1)'=0$ so we have
$$y'' = (\sin x \ln|\sec x +\tan x|)'.$$ Using the product rule we get
$$y''= (\sin x)'\ln|\sec x +\tan x|+\sin x (\ln|\sec x +\tan x|)'.$$
From the table of derivatives $$(\sin x)'=\cos x.$$
We already found $$(\ln|\sec x +\tan x|)' = \frac{1}{\cos x}$$
so finally we write
$$y''=\cos x \ln|\sec x +\tan x| + \sin x\frac{1}{\cos x} =\cos x \ln|\sec x +\tan x| + \tan x.$$
Putting $y$ and $y''$ into the differential equation from the problem we have
The Left side:
$$y''+y=\cos x \ln|\sec x +\tan x| + \tan x + (-\cos x \ln|\sec x + \tan x|) = \tan x $$
The Right side is just $\tan x$. We see that the left side is equal to the right side so we can say that we verified that the given $y$ is a solution to the given differential equation.