# Is there a more elegant way of computing $\int \frac{1}{\sin(x)}dx$ and $\int \frac{1}{\cos(x)}dx$?

Both integrals can be solved by substitution, and while I am comfortable with that, in both cases I find the method unbearably ugly, mostly because there are hundreds of overtly feasible substitutions (and the corresponding factor the denominator and numerator is multiplied by) a when you look at the integral for the very first time, and so the one that happens to work must be memorised, either by rote or experience using it.

Is there a faster or more aesthetically appealing method of computing these (types of) integrals that 'forces the answer upon you' to a greater extent so that the solution does not require bursts of insight or previous experience, and can be applied generally to many types of awkward trigonometric integrals? Something using complex analysis maybe?

Or am I asking mathematics to be a little too easy on me?

-

1
When you talk about substitution, do you mean the trick of multiplying $\sec x$ by $$\frac{\sec x+\tan x}{\sec x+\tan x}$$ and the corresponding trick for $\csc x$? – Brian M. Scott Jan 1 at 17:04
Yes: by 'bursts of insight', I didn't just mean substitution, but multiplying by $1$ written differently. – Alyosha Jan 1 at 17:08
– experimentX Jan 1 at 17:09
That's the sort of thing I'm trying to avoid, as you need a unique epiphany for each integrand. – Alyosha Jan 1 at 17:11

1
definitely you would need experience of patters to calculate integrals. The easiest way ... memorize the results. differentiation of the result will always give you a way which you will never miss. – experimentX Jan 1 at 17:13
show 2 more comments

## 4 Answers

There is a standard trick for a number of trigonometric integrals: substitute $z = \tan(x/2)$. By grinding through the trigonometric identities, you can obtain facts like

• $2\,dz = (1 + z^2)\, dx$
• $\cos(x) = 2/(1 + z^2) - 1$

and such. This converts your integral into a rational function, and you can apply standard methods to those. (e.g. partial fractions)

-

isn't this Weierstrass subs? – experimentX Jan 1 at 17:18
@exp: Yes: I had long forgotten the name. I've added a link to my answer. – Hurkyl Jan 1 at 17:19
This is really the standard method, if I don't want to memorize the result as @experimentX commented above. – Babak S. Jan 1 at 17:24

I think the simpliest way is$$\int\frac{dx}{\cos x}=\int\frac{\cos x dx}{\cos^2 x}=\int\frac{d(\sin x)}{1-\sin^2 x}=\int\frac{dz}{1-z^2}=\frac{1}{2}\left(\int\frac{dz}{1-z}+\int\frac{dz}{1+z}\right)$$ Now these are easy to calculate. The same method works for the other integral also. Generally if you have a integral like $$\int\frac{dx}{\cos x\cdot F(\sin x)}$$ where $F$ is some nice polynomial ( like product of linear and quadratic factors), then you can use the same trick to convert the integral into the form$$\int\frac{dz}{(1-z^2)\cdot F(z)}$$ and try to solve it using the method of partial fractions.

-

Another approach may be:

Let we have $\int R(\sin(x),\cos(x))~dx$ wherein $R$ is a rational function respect to $\sin(x), \cos(x)$. Then we have the following substations also: $$R(-\sin(x),\cos(x))\equiv -R(\sin(x),\cos(x))\Longrightarrow t=\cos(x)\\\ R(\sin(x),-\cos(x))\equiv -R(\sin(x),\cos(x))\Longrightarrow t=\sin(x)$$

For other and general cases you can use what @Hurkyl suggested.

-

Antiderivatives of $1/\sin x$ and $1/\cos x$ are known and usually provided in a table of antiderivatives. See here for instance: http://en.wikipedia.org/wiki/List_of_integrals_of_trigonometric_functions

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 5, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9094168543815613, "perplexity_flag": "middle"}