Given integral

\int \frac{1}{\sin x + \cos x} dx

Step 1: Multiply and divide the denominator with the root 2. Why because to convert the denominator in to the known formula.

\int \frac{1}{\frac{\sqrt{2}}{\sqrt{2}}(\sin x + \cos x)} dx

Step 2: Multiply denominator \sqrt{2} inside the bracket.

\int \frac{1}{\sqrt{2}(\sin x * \frac{1}{\sqrt{2}} + \cos x * \frac{1}{\sqrt{2}})} dx

Step 5: Find the value of \frac{1}{\sqrt{2}} in the form of angle (sin and cos) and substitute in the integral. because we are converting the equation into known formula sin(A + B) = sin A cos B + cos A sin B.

\int \frac{1}{\sqrt{2}(\sin x * \cos \frac{\pi}{4} + \cos x * \sin \frac{\pi}{4})} dx

Step 6: find this in integral sin A cos B + cos A sin B and replace it with sin(A + B)  

(According to the question take the A and B values)

\int \frac{1}{\sqrt{2}}\frac{1}{\sin (x + \frac{\pi}{4})} dx

\int \frac{1}{\sqrt{2}} \cosec (x + \frac{\pi}{4}) dx  (since sin x = \frac{1}{cosec x})

Step 7: Calculate it's value by substituting in the formula of the integration of cosec x

[NOTE] Using formula  \int \cosec x dx = \ln ∣ \tan \frac{x}{2}∣ + C


\int \cosec x dx = ln |cosec x − cot x| = − ln |cosec x + cot x|

Step 8: For this question substitute the x = (x + \frac{\pi}{4}) value in the formulas mentioned in step 7, to get the answer.