To evaluate the integral \( \int e^x (\tan x + \log \sec x) \, dx \), we can break it down into two separate integrals:
\[
\int e^x \tan x \, dx + \int e^x \log \sec x \, dx
\]
### Step 1: Evaluate \( \int e^x \tan x \, dx \)
For the first integral, we can use integration by parts. Let:
- \( u = \tan x \) ⇒ \( du = \sec^2 x \, dx \)
- \( dv = e^x \, dx \) ⇒ \( v = e^x \)
Using the integration by parts formula \( \int u \, dv = uv - \int v \, du \), we get:
\[
\int e^x \tan x \, dx = e^x \tan x - \int e^x \sec^2 x \, dx
\]
### Step 2: Evaluate \( \int e^x \sec^2 x \, dx \)
Now, we need to evaluate \( \int e^x \sec^2 x \, dx \). Again, we can use integration by parts. Let:
- \( u = \sec x \) ⇒ \( du = \sec x \tan x \, dx \)
- \( dv = e^x \, dx \) ⇒ \( v = e^x \)
Using the integration by parts formula again:
\[
\int e^x \sec^2 x \, dx = e^x \sec x - \int e^x \sec x \tan x \, dx
\]
### Step 3: Substitute Back
Now, substituting back into our expression for \( \int e^x \tan x \, dx \):
\[
\int e^x \tan x \, dx = e^x \tan x - \left( e^x \sec x - \int e^x \sec x \tan x \, dx \right)
\]
This simplifies to:
\[
\int e^x \tan x \, dx = e^x \tan x - e^x \sec x + \int e^x \sec x \tan x \, dx
\]
### Step 4: Combine Terms
Notice that we have \( \int e^x \tan x \, dx \) on both sides of the equation. Let’s denote \( I = \int e^x \tan x \, dx \). Then we have:
\[
I = e^x \tan x - e^x \sec x + I
\]
Subtract \( I \) from both sides:
\[
0 = e^x \tan x - e^x \sec x
\]
This leads to:
\[
I = e^x \tan x - e^x \sec x + C
\]
### Step 5: Evaluate \( \int e^x \log \sec x \, dx \)
Now we evaluate the second integral \( \int e^x \log \sec x \, dx \). We can use integration by parts again:
Let:
- \( u = \log \sec x \) ⇒ \( du = \sec x \tan x \, dx \)
- \( dv = e^x \, dx \) ⇒ \( v = e^x \)
Using integration by parts:
\[
\int e^x \log \sec x \, dx = e^x \log \sec x - \int e^x \sec x \tan x \, dx
\]
### Step 6: Combine All Parts
Now we can combine everything:
\[
\int e^x (\tan x + \log \sec x) \, dx = \int e^x \tan x \, dx + \int e^x \log \sec x \, dx
\]
Substituting the results we found:
\[
= \left( e^x \tan x - e^x \sec x + C_1 \right) + \left( e^x \log \sec x - \int e^x \sec x \tan x \, dx + C_2 \right)
\]
The integral \( \int e^x \sec x \tan x \, dx \) cancels out, leading to the final answer:
\[
= e^x \tan x + e^x \log \sec x + C
\]
### Final Answer:
\[
\int e^x (\tan x + \log \sec x) \, dx = e^x \tan x + e^x \log \sec x + C
\]