The first one is fairly simple.

C is just a constant so we can remove that and put it back in at the end.

We know that d(sin(4x))/dx = 4cos 4x, so naturally that means that 4cos 4x integrates to give sin (4x).

However, we want to integrate cos 4x. This is 4 times smaller than 4cos 4x, so we divide the result of that integral by 4.

∫ cos xdx = C/4 sin 4x + c.

c is an arbitrary constant that must always be included when integrating.

---

The second one is harder, because the integral of tan x is less well known. Searching on the internet shows that it is ln |sec x| + c. Now we know this, we can use the same reasoning as in the above example to show that the integral is -1/B * ln|sec x| + c.