# ax+by+c =0

#### apple2357

##### Full Member
So suppose you want the equation of the line that passes through (2,5) and (3, 10) in the form ax+by+c=0

The standard way to do this is to find the gradient and substitute to find the y intercept and tidy up, or you could use y-y_1= m(x-x_1) etc.
I don't understand why it is not possible to substitute the points directly into ax+by+c =0. Two points should be sufficient to find the equation of the line but if you take this approach we have only 2 equations and 3 unknowns?
2a+5b+c = 0
3a+10y+c= 0

Why can't this be made to work?
Tell me if i am talking nonsense!

#### pka

##### Elite Member
So suppose you want the equation of the line that passes through (2,5) and (3, 10) in the form ax+by+c=0

The standard way to do this is to find the gradient and substitute to find the y intercept and tidy up, or you could use y-y_1= m(x-x_1) etc.
I don't understand why it is not possible to substitute the points directly into ax+by+c =0. Two points should be sufficient to find the equation of the line but if you take this approach we have only 2 equations and 3 unknowns?
2a+5b+c = 0
3a+10y+c= 0

Why can't this be made to work?
Tell me if i am talking nonsense!
Surely you know that if a line contains $$\displaystyle (x_1,y_1)~\&~(x_2,y_2)$$ and if $$\displaystyle x_1\ne x_2$$ then its slope is $$\displaystyle m=\dfrac{y_2-y_1}{x_2-x_1}$$.

#### apple2357

##### Full Member
Yes I know all that. I just couldn’t explain why the method and approach above fails ?

#### pka

##### Elite Member
Yes I know all that. I just couldn’t explain why the method and approach above fails ?
Two linear equations in three unknowns???

#### Dr.Peterson

##### Elite Member
So suppose you want the equation of the line that passes through (2,5) and (3, 10) in the form ax+by+c=0

The standard way to do this is to find the gradient and substitute to find the y intercept and tidy up, or you could use y-y_1= m(x-x_1) etc.
I don't understand why it is not possible to substitute the points directly into ax+by+c =0. Two points should be sufficient to find the equation of the line but if you take this approach we have only 2 equations and 3 unknowns?
2a+5b+c = 0
3a+10y+c= 0

Why can't this be made to work?
Tell me if i am talking nonsense!
It works fine! Keep going ... (after fixing a typo).

The only problem is that the answer is not unique -- you can multiply an equation of the form ax+by+c=0 by any non-zero number and the resulting equation is equivalent, and has the same form.

So at some point in your work you will be picking an arbitrary value for either a, b, or c.

#### JeffM

##### Elite Member
So suppose you want the equation of the line that passes through (2,5) and (3, 10) in the form ax+by+c=0

The standard way to do this is to find the gradient and substitute to find the y intercept and tidy up, or you could use y-y_1= m(x-x_1) etc.
I don't understand why it is not possible to substitute the points directly into ax+by+c =0. Two points should be sufficient to find the equation of the line but if you take this approach we have only 2 equations and 3 unknowns?
2a+5b+c = 0
3a+10y+c= 0

Why can't this be made to work?
Tell me if i am talking nonsense!
A system of two equations with three unknowns may have an infinite number of valid solutions.

$$\displaystyle 2a + 5b + c = 0 \text { and } 3a + 10b + c = 0 \implies$$

$$\displaystyle c = -\ (2a + 5b) \implies 3a + 10b - (2a + 5b) = 0 \implies a = -\ 5b.$$

$$\displaystyle \text {Let } b = 1 \implies a = -\ 5 \implies c = -\ (-\ 10 + 5) = 5.$$

$$\displaystyle -\ 5x + y + 5 = 0 \implies y = 5x - 5.$$

$$\displaystyle \therefore x = 2 \implies 5x - 5 = 5 = y, \text { which checks, and}$$

$$\displaystyle x = 3 \implies 5x - 5 = 10 = y, \text { which also checks.}$$

#### JeffM

##### Elite Member
Two linear equations in three unknowns???
But it does work, of course. The answer simply is not unique. The uniqueness and simplicity of the resulting equation is the advantage of the traditional methods of finding the equation of a line joining two distinct points. However, simply add b = 1 as a third equation to get the traditional, simple answer.

I think you missed the thrust of the OP. It was asking why a proposed method does NOT work, but it does work. The OP incorrectly assumed that a system of two equations with three unknowns has no valid solutions. The premise of the question was therefore confusing.

Last edited:

#### apple2357

##### Full Member
Ok. So the method does completely work.
You just have to pick a value for b ( which can be anything) and the resulting equation will still be unique ( after simplifying) - so there is no problem with this approach at all?

#### JeffM

##### Elite Member
Ok. So the method does completely work.
You just have to pick a value for b ( which can be anything) and the resulting equation will still be unique ( after simplifying) - so there is no problem with this approach at all?
There is no conceptual problem, but, in terms of communication, it is very common (and therefore readily comprehensible) to state a linear equation as

$$\displaystyle y = ux + v.$$

This results from setting b = 1. This form immediately gives the slope and the y-intercept and so is mathematically useful.

Last edited:

#### HallsofIvy

##### Elite Member
The problem is that while any straight line can be written as ax+ by+ c= 0 that form is not unique! Multiplying each term by d gives a'x+ b'y+ c'= 0, where a'= ad, b'= bd, and c'= cd, a different equation for the same line. If you (arbitrarily) take a= 1 then you have x+ by+ c= 0. The line passes through (2,5) and (3, 10) so you have the two equations, 2+ 5b+ c= 0 and 3+ 10b+ c= 0, to solve for the two unknowns, b and c.

#### apple2357

##### Full Member
That makes sense!

#### Jomo

##### Elite Member
The line y=3x+4 and the line 2y=6x+8 both have the same exact points! The form y = 3x+4 or y = mx+b just insists that the coefficient of y is 1. In ax+by +c=0, b does not have to be 1!
For the record, the form is usually written as ax+by = c


+0

# 11. You deposit $200 each month into an account earning 3% interest compounded monthly. a. How much will you have in the account in 30 years 0 6713 13 11. You deposit$200 each month into an account earning 3% interest compounded monthly.

a. How much will you have in the account in 30 years?

b. How much total money will you put into the account?

c. How much total interest will you earn?

Guest Jul 31, 2015

#2
+26406
+10

.

Alan  Jul 31, 2015
Sort:

#1
0

a)200*1.03^30 = $485.45 b) c) 200*1.03^30 minus$200

Guest Jul 31, 2015
#2
+26406
+10

.

Alan  Jul 31, 2015
#3
+91477
+5

11. You deposit $200 each month into an account earning 3%(per annum) interest compounded monthly. I am assuming that the money goes in at the beginning of the month and the interest is paid at the end of the month. a. How much will you have in the account in 30 years? b. How much total money will you put into the account? c. How much total interest will you earn? a) You can also do this with the future value of an ordinary annuity formula C=200 n=30*12=360 i=0.03/12 = 0.0025 Amount after 30 years =$116547.38

$${\mathtt{200}}{\mathtt{\,\times\,}}\left({\frac{\left({{\mathtt{1.002\: \!5}}}^{{\mathtt{360}}}{\mathtt{\,-\,}}{\mathtt{1}}\right)}{{\mathtt{0.002\: \!5}}}}\right) = {\mathtt{116\,547.376\: \!919\: \!658\: \!203\: \!63}}$$

b)  $${\mathtt{200}}{\mathtt{\,\times\,}}{\mathtt{360}} = {\mathtt{72\,000}}$$

You  have put $72,000 into the account. c) Interest =$116547.38 - $72,000 =$44547.38

$${\mathtt{116\,547.38}}{\mathtt{\,-\,}}{\mathtt{72\,000}} = {\mathtt{44\,547.38}}$$

Melody  Jul 31, 2015
#4
+26406
+5

The small difference between my result and Melody's is that I've assumed the the total includes the interest paid at the end of the last month; whereas Melody's assumes that in the last month only the $200 deposited at the beginning of the month is added in. . Alan Jul 31, 2015 #5 +1037 +5 For this type of investment, the “Annuity Due” formula returns the correct future value for standard depository account interest payments, correlating to the beginning of the month deposit and end of the month interest payment. This returns the same value as Alan’s result. $$\\ \noindent \text {Annuity Due: }{FV = D \dfrac{(1 + r)^{n} - 1} {r}(1 + r)}\hspace{20pt} |\hspace{10pt} \text {\small D=Deposit per interval}\\ \\ 200*\dfrac{(1.0025^{360}-1)}{0.0025}*(1.0025)\;=\;116838.75$$ In practice, financial institutions use the “average daily balance” to calculate the interest on deposits. The result returns a value with limits between the two formulas. $$\text {FV(annuity ordinary) \leq Total Interest \leq FV(annuity due)}$$ Nauseated Jul 31, 2015 #6 +91477 +5 Yes, sorry Alan I did not realize that our answers were different. Alan is totally corect. This is the formula for the the future value of an ordinary annuity. This is where the money is put into the account at the END of the time period instead of at the beginning. It is easy to adjust it for this question. Here we have$200 invested at the very beginning so we must ADD 200 plus the interest it will accrue for the whole 30 years  that will be    C(1+i)^n = 200*(1.0025^360)

but NO $200 is invested at the very end SO we must subtract C =$200 at the end

so we get

$$\\FV=\left[\frac{(1+i)^n-1}{i}\right]+C(1+i)^n-C\\\\ If you rearrange this you will find that it is identical to Nauseated's formula.\\\ FV=my original answer+C(1+i)^n-C\\\\ FV=116547.38+200(1.0025)^{360}-200\\\\$$

$${\mathtt{116\,547.38}}{\mathtt{\,\small\textbf+\,}}{\mathtt{200}}{\mathtt{\,\times\,}}{\left({\mathtt{1.002\: \!5}}\right)}^{\left({\mathtt{360}}\right)}{\mathtt{\,-\,}}{\mathtt{200}} = {\mathtt{116\,838.748\: \!442\: \!299\: \!145\: \!509\: \!1}}$$

FV = $116838.75 This is identical to Alan's answer. And Nauseated also agreed that it is correct. ------------------------------------------ Nauseated has gone one more step with this. He has said: "In practice, financial institutions use the “average daily balance” to calculate the interest on deposits." Yes this is correct Nauseated has then stated that: "The result returns a value with limits between the two formulas. " Yes I can see how this could possibly be justified.. but I would like Nauseated to justify/discuss this statement. :) Melody Aug 1, 2015 #7 0 I was in finance for years. I never heard of treating saving account like any kind of annuity. This looks like a ton of BS to me. Guest Aug 2, 2015 #8 +1037 +5 It’s not that you never heard of it, you simply forgot. That can happen when you are stoned in class. BTW, playing Monopoly is not the same as being in finance. In any case, a managed depository savings account can match the return of either type of annuity. I will demonstrate this in the next post. Nauseated Aug 2, 2015 #9 +91477 0 My goodness, that is excessively polite for you Nauseated ! Are you unwell ? Melody Aug 2, 2015 #10 +1037 +5 ### The following data sets shows first 12 months and the last 12 months of a hypothetical account of 360 interest cycles. The first column displays the$200 deposit; the second column displays the end of month interest payment on the previous balance and the $200 first day of month deposit. Column 3 displays the new balance. Column 4 is the multiplier that weights the deposit for the purpose of interest calculation. The multiplier is from 1 to 0, representing the average daily deposit of the$200, where 1 is a deposit on the first day and 0 is a deposit on the last day. (No withdraws are made from this account and only the deposit is weighted).

Column 5 is the average daily of the deposit.

Column 6 is the interest.

Column 7 is the balance.

Note that the final balance in column 3 matches the annuity due, while the final balance in column 7 matches the annuity ordinary.

$$\displaystyle \noindent \small {First data set. Months 1-12}\\ \begin{tabular}{lllllll} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline 200.00 & 0.50 & 200.50 & 0.00 & 0.00 & 0.00 & 200.00 \\ 200.00 & 1.00 & 401.50 & 0.00 & 0.00 & 0.50 & 400.50 \\ 200.00 & 1.50 & 603.01 & 0.00 & 0.00 & 1.00 & 601.50 \\ 200.00 & 2.01 & 805.01 & 0.00 & 0.00 & 1.50 & 803.01 \\ 200.00 & 2.51 & 1,007.53 & 0.00 & 0.00 & 2.01 & 1,005.01 \\ 200.00 & 3.02 & 1,210.54 & 0.00 & 0.00 & 2.51 & 1,207.53 \\ 200.00 & 3.53 & 1,414.07 & 0.00 & 0.00 & 3.02 & 1,410.54 \\ 200.00 & 4.04 & 1,618.11 & 0.00 & 0.00 & 3.53 & 1,614.07 \\ 200.00 & 4.55 & 1,822.65 & 0.00 & 0.00 & 4.04 & 1,818.11 \\ 200.00 & 5.06 & 2,027.71 & 0.00 & 0.00 & 4.55 & 2,022.65 \\ 200.00 & 5.57 & 2,233.28 & 0.00 & 0.00 & 5.06 & 2,227.71 \\ 200.00 & 6.08 & 2,439.36 & 0.00 & 0.00 & 5.57 & 2,433.28 \end{tabular}$$

$$\displaystyle \noindent \small {First data set. Months 349-360}\\ \begin{tabular}{lllllll} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline 200.00 & 278.06 & 111500.59 & 0.00 & 0.00 & 276.86 & 111222.53 \\ 200.00 & 279.25 & 111979.84 & 0.00 & 0.00 & 278.06 & 111700.59 \\ 200.00 & 280.45 & 112460.29 & 0.00 & 0.00 & 279.25 & 112179.84 \\ 200.00 & 281.65 & 112941.94 & 0.00 & 0.00 & 280.45 & 112660.29 \\ 200.00 & 282.85 & 113424.79 & 0.00 & 0.00 & 281.65 & 113141.94 \\ 200.00 & 284.06 & 113908.85 & 0.00 & 0.00 & 282.85 & 113624.79 \\ 200.00 & 285.27 & 114394.13 & 0.00 & 0.00 & 284.06 & 114108.85 \\ 200.00 & 286.49 & 114880.61 & 0.00 & 0.00 & 285.27 & 114594.13 \\ 200.00 & 287.70 & 115368.31 & 0.00 & 0.00 & 286.49 & 115080.61 \\ 200.00 & 288.92 & 115857.23 & 0.00 & 0.00 & 287.70 & 115568.31 \\ 200.00 & 290.14 & 116347.38 & 0.00 & 0.00 & 288.92 & 116057.23 \\ 200.00 & 291.37 & 116838.75 & 0.00 & 0.00 & 290.14 & 116547.38 \end{tabular}$$

The second data sets are the same as the first, except the multiplier is set to 0.75. This corresponds to a depositor making two deposits of $100 each on the first and 15 of each 30-day month. $$\displaystyle \noindent \small {Sceond data set. Months 1-12}\\ \begin{tabular}{lllllll} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline 200.00 & 0.50 & 200.50 & 0.75 & 150.00 & 0.38 & 200.38 \\ 200.00 & 1.00 & 401.50 & 0.75 & 150.00 & 0.88 & 401.25 \\ 200.00 & 1.50 & 603.01 & 0.75 & 150.00 & 1.38 & 602.63 \\ 200.00 & 2.01 & 805.01 & 0.75 & 150.00 & 1.88 & 804.51 \\ 200.00 & 2.51 & 1007.53 & 0.75 & 150.00 & 2.39 & 1006.90 \\ 200.00 & 3.02 & 1210.54 & 0.75 & 150.00 & 2.89 & 1209.79 \\ 200.00 & 3.53 & 1414.07 & 0.75 & 150.00 & 3.40 & 1413.19 \\ 200.00 & 4.04 & 1618.11 & 0.75 & 150.00 & 3.91 & 1617.10 \\ 200.00 & 4.55 & 1822.65 & 0.75 & 150.00 & 4.42 & 1821.51 \\ 200.00 & 5.06 & 2027.71 & 0.75 & 150.00 & 4.93 & 2026.44 \\ 200.00 & 5.57 & 2233.28 & 0.75 & 150.00 & 5.44 & 2231.88 \\ 200.00 & 6.08 & 2439.36 & 0.75 & 150.00 & 5.95 & 2437.84 \end{tabular}$$ $$\displaystyle \noindent \small {Sceond data set. Months 349-360}\\ \begin{tabular}{lllllll} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline 200.00 & 278.06 & 111500.59 & 0.75 & 150.00 & 277.76 & 111431.07 \\ 200.00 & 279.25 & 111979.84 & 0.75 & 150.00 & 278.95 & 111910.02 \\ 200.00 & 280.45 & 112460.29 & 0.75 & 150.00 & 280.15 & 112390.17 \\ 200.00 & 281.65 & 112941.94 & 0.75 & 150.00 & 281.35 & 112871.52 \\ 200.00 & 282.85 & 113424.79 & 0.75 & 150.00 & 282.55 & 113354.08 \\ 200.00 & 284.06 & 113908.85 & 0.75 & 150.00 & 283.76 & 113837.84 \\ 200.00 & 285.27 & 114394.13 & 0.75 & 150.00 & 284.97 & 114322.81 \\ 200.00 & 286.49 & 114880.61 & 0.75 & 150.00 & 286.18 & 114808.99 \\ 200.00 & 287.70 & 115368.31 & 0.75 & 150.00 & 287.40 & 115296.39 \\ 200.00 & 288.92 & 115857.23 & 0.75 & 150.00 & 288.62 & 115785.00 \\ 200.00 & 290.14 & 116347.38 & 0.75 & 150.00 & 289.84 & 116274.84 \\ 200.00 & 291.37 & 116838.75 & 0.75 & 150.00 & 291.06 & 116765.90 \end{tabular}$$ ... Nauseated Aug 2, 2015 #11 +1037 0 My goodness, that is excessively polite for you Nauseated ! Overt politeness is one of my faults. I try, but I am not always successful. Are you unwell ? Yes! I am unwell. I am Nauseated. It seems worse than usual. . . . Maybe it's sympathetic morning sickness. :) Nauseated Aug 2, 2015 #12 +91477 0 Is Mrs Nauseated pregnant? Congratulations ! The name you have inflicted upon her will suit her well for a while :/ Melody Aug 2, 2015 #13 +91477 +5 ok Nauseated you have a lot of figures there but I am going to be so bold as to summarize your reasoning. The question does not state WHEN the money was deposited into the account. IF it is deposited at the very beginning of the month then it is an annuitiy due question and yours and Alan figures are correct (a tiny bit too big) If it is deposited at the very end of the month then it is an ordinary annuity question and my original answer was in fact correct. (a tiny bit to small) HOWEVER If the$200 deposit is made at another time or times during the month then this will make the Future value lie between  the 2 extremes.

SEE Nauseated - that was not so hard.  You really did not need all those tables of values.

I am quite positive you will correct me if I have misinterpreted your logic.

-----------------------------------

The reason I have added "a tiny bit too big" and a "tiny bit too small" is because there is always going to be one day at the end, or the beginning, of the month which has the old value at the beginning and the new value at the end so effectively this day has interest paid on the new deposit of only \$100  (average of 0 and 200) [Not 0 (ordinary annuity) or 200 (annuity due)  as used for the development of the formula]

Melody  Aug 2, 2015

### 6 Online Users

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.  See details


# How can I solve the following square root inequality?

I am given the following inequality:

$$\sqrt{2-x} > x$$

And I have to solve for $$x$$.

This is what I tried:

Firstly, I applied the existence condition for the square root:

$$2-x \ge 0 \Rightarrow x \le 2 \Rightarrow x \in (- \infty, 2]$$

Then I squared both sides of the inequality:

$$2-x>x^2$$

$$x^2+x-2 < 0$$

And from this I got that:

$$x \in (-2, 1)$$

Finally, I intersected this with the condition I applied at the beginning of the exercise:

$$x \in (-2, 1) \cap (- \infty, 2]$$

$$x \in (-2, 1)$$.

The problem with this answer is that it is wrong. If I take a number like $$-10$$ and plug it into the inequality I get:

$$\sqrt{2-(-10)} > -10$$

$$\sqrt{12} > -10$$

Which is true. However $$-10$$ is not included in the interval $$(-2, 1)$$. The correct answer seems to be $$(- \infty, 1)$$, which is not what I got.

I noticed that the inequalities of before and after of the squaring are not equivalent. So:

$$\sqrt{2-x} > x$$

and

$$2-x>x^2$$

are not equivalent. If, again, I take the number $$-10$$, in the first inequality I get:

$$\sqrt{2-(-10)} > -10$$

$$\sqrt{12} > -10$$, which is true.

And in the second inequality I get:

$$2 - (-10) > (-10)^2$$

$$12 > 100$$, which is false.

So I think that's where the problem lies, but I don't know if I am correct and what should I do to get the right answer of $$(- \infty, 1)$$.

• When you're solving $$x^2 +x -2 > 0$$ you need to remember that previously you have found both $x\leq 2$ and $x>0$ (because square root cannot be negative). So in this case you're limited to $0 \leq x \leq 2$, before even looking at solving this equation. – Matti P. Oct 30 '19 at 13:29
• "Then I squared both sides of the inequality:" $x > y\not \implies x^2 > y$ unless $y \ge 0$. If $x > 0 > y$ then multiplying by $y$ flips the signs and $x>0 >y \implies xy < 0 < y^2$. And multiplying by $x$ doesn't flip and $x > 0 > y\implies x^2 > 0 >xy$ and we have $x^2 > xy$ and $xy < y^2$ and we can't conclude anything about $x^2$ compared to $y^2$. – fleablood Oct 31 '19 at 6:42
• @MattiP., the non-negativity restriction on the square root only implies $x\le2$ (as the OP found). It does not require $x\ge0$. Indeed, the inequality $\sqrt{2-x}\gt x$ is clearly true for all $x\lt0$. – Barry Cipra Oct 31 '19 at 12:45

"Then I squared both sides of the inequality:"

$$a > b\not \implies a^2 > b^2$$ unless $$b \ge 0$$.

If $$a > 0 > b$$ then multiplying by $$b$$ flips the signs and $$a>0 >b \implies ab < 0 < b^2$$. And multiplying by $$a$$ doesn't flip and $$a > 0 > b\implies a^2 > 0 >ab$$.

[Remember the reason that $$m > n > 0 \implies m^2 > n^2$$ is that because $$n > 0$$ we know $$m>n \implies mn > nn = n^2$$ and because $$m >0$$ we know $$m^2 = mm > mn$$. So we have $$m^2 >mn$$ and $$mn > n^2$$ so $$m^2 > n^2$$. That simply will not work of one of $$m,n$$ is negative. (and if both are negative you get the exact opposite result: $$0 > m>n\implies m^2 < n^2$$.]

So we have $$a^2 > ab$$ and $$ab < b^2$$ and we can't conclude anything about $$a^2$$ compared to $$b^2$$.

.... Or ....

just to be blunt.

$$3 > -987$$ by $$3^2 \not > (-987)^2$$.

....

But you can square both sides if you acknowedge you are assuming $$x \ge 0$$ as a conditional that may not be true.

so when you get $$x \in (-2,1)$$ IF $$x \ge 0$$ so $$[0,1)$$ you can intersect it with the positive values you had before. $$(-\infty, 2] \cap [0,1)=[0,1)$$ IFF $$x \ge 0$$.

But we CAN have $$x < 0$$ in which case ... squaring both sides is useless.

So either $$x < 0$$ and $$x\in (-\infty, 0)$$ OR $$x \ge 0$$ and $$x\in [0,1)$$ and so $$x \in (-\infty,0) \cup [0,1) = (-\infty, 1)$$>

The domain of the root is given by b$$x\le 2$$ Now we will consider two cases: If $$x\le 0$$ the our inequality is true. If $$x then we can square and we get $$0>x^2+x-2$$ This gives us $$-2 and $$0 and we get $$0 So the solution set is given by $$x<1$$ and $$x$$ is a real number.

$$\sqrt{2-x} > x$$ then $$\sqrt{2-x} > x-2 +2$$ , move all to the left hand side then $$2-x = (\sqrt{2-x})^2$$ $$\left(\sqrt{2-x}\right)^2 + \sqrt{2-x} - 2 > 0$$ $$( \sqrt{2-x} +2) (\sqrt{2-x} -1)>0$$ I avoided squaring both sides.

Starting from

$$\sqrt{2-x} > x$$

it is immediately clear that if $$x<0$$ then $$\sqrt{2-x} >0$$ and therefore $$x<0$$ is part of the solution set. We then need to analyze where

$$\sqrt{2-x}$$

is defined. We know that $$\sqrt{2-x}$$ will have positive real solutions if $$2-x \ge 0$$. Therefore, we need to check $$0\le x \le 2$$. In order to do this, let $$\varepsilon$$ be a small number where $$0\le\varepsilon< 1$$. Then $$\sqrt{2-\varepsilon}>\sqrt{1}> \varepsilon$$ $$\sqrt{2-1}=\sqrt{1}=1$$ $$\sqrt{2-(\varepsilon+1)}\le\sqrt{1}\le\varepsilon+1$$

so when $$0\le x < 1$$ we have $$\sqrt{2-x} > x$$ and when $$1\le x \le 2$$ we have $$\sqrt{2-x} \le x$$. Hence, the proper solution set is $$x<1$$ or $$(-\infty,1)$$.

An alternative approach is to start from the fact that we must have $$x\le 2$$ in order for $$\sqrt{2-x}$$ to exist, and write $$x=2-u^2$$ with $$u\ge0$$, which simplifies the inequality to $$u\gt2-u^2$$ (with, remember, $$u\ge0$$, which is used in removing the square root symbol to obtain $$\sqrt{u^2}=u$$). Standard algebra manipulates this to the equivalent form $$(u-1)(u+2)\gt0$$, which, given the restriction to $$u\ge0$$, implies $$u\gt1$$. Substituting back to $$x=2-u^2$$, we see we have $$x\lt2-1^2=1$$, so the solution set for the inequality is $$x\in(-\infty,1)$$.

In review, you have to do something to get rid of the square root symbol in order to find the solution set for the inequality. Squaring both sides certainly does this, but you have to contend with the fact that $$a\gt b$$ is not equivalent to $$a^2\gt b^2$$ without additional restrictions on $$a$$ and $$b$$, so that after you've found the solution set for the squared inequality you have to see how it relates to the original inquality. The approach here is somewhat simpler in that regard; in essence, it puts all its restrictive eggs into a single basket of non-negativity (i.e., $$u\ge0$$).

I think fleablood’s answer gets closest to addressing what I think OP was asking, namely why the mechanical application of squaring both sides of the equation does not yield all of the solutions.


# Determining convergence of series

#### calcboi

##### New member
I have a question on which test to use for series n=1 to infinity for (-1)^n / (n^3)-ln(n) in order to determine convergence/divergence. I am pretty sure I determined it converges through the Alternating Series Test(correct me if I'm wrong) but I am not sure whether it is conditional or absolute. I tried the Direct Comparison Test but it was inconclusive, and I am stuck now on what to do. I also tried Limit Comparison but the limit goes to infinity so it is also inconclusive. Can you please help?

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
Yes you are correct.

near infinity the term n^3 is dominant over ln (n).

#### calcboi

##### New member
BTW, I used the comparison c(x) = 1/n^3 for DCT and LCT since we know 1/n^3 converges by p-series.

#### Fernando Revilla

##### Well-known member
MHB Math Helper
BTW, I used the comparison c(x) = 1/n^3 for DCT and LCT since we know 1/n^3 converges by p-series.
Right, $\displaystyle\lim_{n\to \infty}\left(\frac{1}{n^3-\log n}:\frac{1}{n^3}\right)=\ldots =1\neq 0$, so the series is absolutely convergent.

#### calcboi

##### New member
What test did you use to determine absolute convergence? Or was that just analyzing end behavior?

MHB Math Helper

#### Fernando Revilla

##### Well-known member
MHB Math Helper
When I tried the Limit Comparison Test, I got infinity as n approaches infinity. How did you get 1?
$\displaystyle\lim_{n\to \infty}\left(\frac{1}{n^3-\log n}:\frac{1}{n^3}\right)=\lim_{n\to \infty}\frac{n^3}{n^3-\log n}=\lim_{n\to \infty}\frac{1}{1-(\log n/n^3)}=\frac{1}{1-0}=1$


# When to use L'Hospital's rule vs the limit shortcut

Before being so quick to downvote or throw darts, please forgive my ignorance and inability to recall basic calculus atm.

Consider the limit $\lim \limits_{x \to \infty}\frac{3x^2+14x-5}{x^2+x-12}$. It can quickly be determined that the $x$ approaches $3$ using L'Hospital's rule.

The same answer can be derived, however, by using this shortcut (I am unaware if it has a specific name):

$\lim \limits_{x \to \infty}\frac{3x^2+14x-5}{x^2+x-12}=\lim \limits_{x \to \infty}\frac{3x^2/x^2+14x/x^2-5/x^2}{x^2/x^2+x/x^2-12/x^2}$

Every term is divided by the highest degree of $x$ in the denominator. The terms with $x^2$ in both the numerator and denominator simplify. All other terms go to $0$. Therefore:

$\lim \limits_{x \to \infty}\frac{3x^2/x^2+14x/x^2-5/x^2}{x^2/x^2+x/x^2-12/x^2}=\frac{3}{1}=3$

1) What are the explicit conditions in which may I use this shortcut?

2) How do I know when to use it over L'Hospital's rule, as both techniques can be used only when working with quotients?

3) What is the shortcuts name, if any?

• Your second method is the more common one --- you use L'Hopital's when it fails (provided you satisfy the right conditions for L'Hopital's). This typically works when you have a quotient of polynomials (or in cases like totoro has pointed out), whereas L'Hopital's works for other kinds of functions, too. I don't think it has a universal name. – Bill Wallis May 11 '18 at 21:35
• In class I usually recommend it when there is a quotient of sums of terms that can easily be compared in its growth to infinity. It would also be applicable, for example, to $\lim_{n\to\infty}\frac{n!+3^n-n^{50}}{2\ln(n)-e^{n^2}+2\sin(n)}$. Here 'compared' means knowing the limit of the quotient of the different terms. whether the quotient tends to $0$, to $\infty$, or if it remains bounded. – user551819 May 11 '18 at 21:37
• In my opinion L'Hopital is rarely the method of choice. Almost any other that works is more informative. This trick is good for quotients of polynomials. In general, writing down the first few terms of the power series for the various elements and looking at the leading term will often help. There are questions/answers on this site on the general theme "why not to use L'Hopital". – Ethan Bolker May 11 '18 at 21:40
• L'Hopital can also be used in not quotient indeterminate limits. – Namaste May 11 '18 at 21:42
• One can also use simplification of rational functions, e.g. $\lim_{x\to 2} \frac{x-2}{x^2-4} = \lim_{x\to 2} \frac 1{x+2} = \frac 14.$ Or $$\lim_{x\to 1}\frac{x^2+x-2}{x^3-x^2-3x+3} = \lim_{x\to 1}\frac{x+2}{x^2-3} = -\frac 32$$ – Namaste May 11 '18 at 21:51

Shorcut can be used in quotient limits anytime there exist some leading term at the numerator and denominator which becomes dominant in the limit with respect to the others terms that is, indicating with g(x) the dominant term

$$\lim \limits_{x \to \infty}\frac{f(x)}{g(x)}=0$$

To individuate the dominant term, recall that

• $\frac{x^a}{x^b} \to 0$ for $b>a$

• $\frac{x^a}{b^x} \to 0$ for $b>1$

• $\frac{\log x}{x^a} \to 0$ for $a>0$

and for sequences

• $\frac{a^n}{n!} \to 0$ for $a>1$

• $\frac{n!}{n^n} \to 0$

Recall that l'Hopital rule can be applied to limits which are expressed (or can be expressed) by quotient which are in the indeterminate form $\frac 0 0$ or $\frac{\pm \infty}{\pm \infty}$.

I don't think there is a specific name for the shorcut.

As indicated in the comment another way for rational expression can be the following

$$\frac{3x^2+14x-5}{x^2+x-12}=\frac{3x^2+3x-12+11x+7}{x^2+x-12}=3+\frac{11x+7}{x^2+x-12}$$

• @amWhy Something wrong or not clear? – gimusi May 11 '18 at 21:41
• But L'Hopital can be used in other situations too. – Namaste May 11 '18 at 21:42
• @amWhy are you referring to $0\cdot \infty$? – gimusi May 11 '18 at 21:43

On the other hand, it's not difficult to prove a general theorem about rational functions. Suppose you have $$f(x)=\frac{a_mx^m+a_{m-1}x^{m-1}+\dots+a_0}{b_nx^n+b_{n-1}x^{n-1}+\dots+b_0}$$ with $a_m\ne0$ and $b_n\ne0$. Then, since it's not restrictive to assume $x>0$ when we want to compute the limit for $x\to\infty$, the numerator can be written as $$x^m\left(a_m+\frac{a_{m-1}}{x}+\dots+\frac{a_0}{x^m}\right)$$ and the factor in parentheses has limit $a_m$ when $x\to\infty$. Similarly for the denominator. Now $$\lim_{x\to\infty} \frac{\displaystyle a_m+\frac{a_{m-1}}{x}+\dots+\frac{a_0}{x^m}} {\displaystyle b_n+\frac{b_{n-1}}{x}+\dots+\frac{b_0}{x^m}} =\frac{a_m}{b_n}\ne0$$ Hence there are three cases.

## First case: $m>n$

$$\lim_{x\to\infty}f(x)= \lim_{x\to\infty}x^{m-n} \frac{\displaystyle a_m+\frac{a_{m-1}}{x}+\dots+\frac{a_0}{x^m}} {\displaystyle b_n+\frac{b_{n-1}}{x}+\dots+\frac{b_0}{x^m}} = \begin{cases} \infty & \text{if a_m/b_n>0} \\[4px] -\infty & \text{if a_m/b_n<0} \end{cases}$$ The factor $x^{m-n}$ has limit $\infty$ and the other factor is bounded.

## Second case: $m=n$

$$\lim_{x\to\infty}f(x)= \lim_{x\to\infty} \frac{\displaystyle a_m+\frac{a_{m-1}}{x}+\dots+\frac{a_0}{x^m}} {\displaystyle b_n+\frac{b_{n-1}}{x}+\dots+\frac{b_0}{x^m}} =\frac{a_m}{b_n}$$

## Third case: $m<n$

$$\lim_{x\to\infty}f(x)= \lim_{x\to\infty}\frac{1}{x^{n-m}} \frac{\displaystyle a_m+\frac{a_{m-1}}{x}+\dots+\frac{a_0}{x^m}} {\displaystyle b_n+\frac{b_{n-1}}{x}+\dots+\frac{b_0}{x^m}} =0$$ The factor $1/x^{n-m}$ has limit $0$ and the other factor has limit $a_m/b_n$.

This completely settles the problem and you need nothing else: your given limit is $3$ because the function is in case two. Doing umpteen times the same computations doesn't seem the best way to spend our time.

How can you remember this? The polynomial of greater degree dominates: if it is at the numerator, the limit is $\pm\infty$ (with the sign determined by $a_m/b_n$); if it is at the denominator, the limit is $0$. If the degrees are the same, the limit is $a_m/b_m$.

• This is essentially the mnemonic “Bobo Bots eats DC”—bigger on bottom: $0$; bigger on top: slant; exponents are the same: divide coefficients. – gen-z ready to perish May 11 '18 at 22:23
• @ChaseRyanTaylor I don't like such kind of mnemonics, TBH. But this is quite a simple case to handle and a general rule is surely handy. There's a similar case for integrals of the form $\int x^ne^x\,dx$; rather than doing umpteen integrations by parts, it's much easier to remember the antiderivative is of the form $P(x)e^x$ with $P$ of degree $n$ and do the derivative. – egreg May 11 '18 at 22:32

In general, suppose you have an expression of the form

$$f_1(x)+f_2(x)\over g_1(x)+g_2(x)$$

for which

$$\lim_{x\to c}{f_2(x)\over f_1(x)}=\lim_{x\to c}{g_2(x)\over g_1(x)}=0$$ Then

$$\lim_{x\to c}{f_1(x)+f_2(x)\over g_1(x)+g_2(x)}=\lim_{x\to c}{f_1(x)\over g_1(x)}$$

The proof amounts to inserting the intermediate expression

$$\lim_{x\to c}{f_1(x)\over g_1(x)}\cdot{1+{f_2(x)\over f_1(x)}\over1+{g_2(x)\over g_1(x)}}$$

A nice example, in which L'Hopital gets you nowhere, is

$$\lim_{x\to\infty}{5e^{3x}+2e^x\over2e^{3x}+7e^{2x}}=\lim_{x\to\infty}{5e^{3x}\over2e^{3x}}=\lim_{x\to\infty}{5\over2}={5\over2}$$

The trick, in general, is to recognize a dominant term in the numerator and/or denominator. In essence, the shortcut says you can ignore all the other stuff. But you have to make sure that you pick out terms that really do dominate the other stuff; sometimes you can eyeball it, and sometimes you make mistakes (at least I do).

• Have you got an explicit description of what a dominant term is? – rainier May 11 '18 at 22:44
• @rainier, it's what the second display says: the quotient of the "other stuff" to the "dominant" term tends to $0$ in the limit. In the example, we have $(2e^x)/(5e^{3x})={2\over5}e^{-2x}\to0$ and $(7e^{2x})/(2e^{3x})={7\over2}e^{-x}\to0$ as $x\to\infty$. – Barry Cipra May 11 '18 at 22:49
• Got it, thanks! – rainier May 11 '18 at 22:53


# Number of ways in which they can be seated if the $2$ girls are together and the other two are also together but separate from the first two

$5$ boys and $4$ girls sit in a straight line. Find the number of ways in which they can be seated if $2$ girls are together and the other two are also together but separate from the first two.

I divided the $4$ girls in two groups in $\frac{4!}{2!2!}$ ways.

I counted $10$ ways in which there is at least one boy between the two girl pairs. Boys can be arranged in $5!$ ways. Total number of ways$=\frac{4!}{2!2!}\times 10\times 5!=7200$

But the answer in the book is $43200$. I don't know where I am wrong.

• What do you mean "the two girls are together"? That makes it sound as if the pair is specified. – lulu Apr 4 '16 at 16:10
• Sorry,"the" was not given,i edited it.@lulu – mathspuzzle Apr 4 '16 at 16:13
• no problem. I'll post something below. – lulu Apr 4 '16 at 16:13

Method I: Fix two ordered pairs of girls $AB,CD$. Then there are $7!$ ways to arrange the five boys and these two dyads. Of course we might have $ABCD$ together, so to rule that out subtract $6!$. Similarly, we must rule out another factor of $6!$ to exclude $CDAB$. Thus for these two ordered pairs there are $$7!-2\times 6!=3600$$ suitable arrangements.
Now, sticking to these pairs but varying the order gets us $$4\times 3600=14,400$$
And, finally, we can change the pairs. Instead of $AB$ we could have had $AC$ or $AD$ so, finally, $$3\times 14,400= 43,200$$
Method II: (closer to what you were trying) Arrange the kids as $$-\;AB-CD\;-$$ Where $A,B,C,D$ denote the four girls (unspecified) and the boys go in the dashed areas. We know the middle dashed area must contain at least a single boy. There are $15$ satisfactory ways to arrange the boys: $$\{0,5,0\},\;\{1,4,0\},\;\{0,4,1\},\;\{2,3,0\},\;\{0,3,2\},\;\{1,3,1\},\;\{3,2,0\},\;\{0,2,3\},\;\{2,2,1\},\;\{1,2,2\},\;\{3,1,1\},\;\{1,1,3\},\{2,1,2\},\;\{4,1,0\},\;\{0,1,4\}$$ (I'm writing them all out because I believe you only counted $10$ of these). We must then pick some permutation of the girls to fill the slots labeled $A,B,C,D$ and pick some permutation of the boys to populate the dashed regions thus $$15\times 4!\times 5!=43,200$$
First we count the number of strings of length $7$ made up of the letters b (a single boy) and $G$ (a pair of girls) such that the two G's are not together. Write down five b's like this, with a little gap between them. $$\text{b}\qquad\text{b}\qquad\text{b}\qquad\text{b}\qquad\text{b}$$ These determine $6$ gaps, the $4$ obvious ones and $2$ endgaps. We want to choose two of these to insert the G's into. This can be done in $\binom{6}{2}$ ways.
We have found the number of "patterns." Now permute the girls, permute the boys. The number of arrangements is $\binom{6}{2}4!5!$.


# Floating Point¶

## Storage overview¶

We can think of a floating point number as having the form:

$\mbox{significand} \times 10^\mbox{exponent}$

Most computers follow the IEEE 754 standard for floating point, and we commonly work with 32-bit and 64-bit floating point numbers (single and double precision). These bits are split between the signifcand and exponent as well as a single bit for the sign:

Since the number is stored in binary, we can think about expanding a number in powers of 2:

$0.1 \sim (1 + 1 \cdot 2^{-1} + 0 \cdot 2^{-2} + 0 \cdot 2^{-3} + 1 \cdot 2^{-4} + 1 \cdot 2^{-5} + \ldots) \times 2^{-4}$

In fact, 0.1 cannot be exactly represented in floating point:

Listing 52 simple_roundoff.cpp
#include <iostream>
#include <iomanip>

int main() {

double a = 0.1;

std::cout << std::setprecision(19) << a << std::endl;

}

### Precision¶

With 52 bits for the significand, the smallest number compared to 1 we can represent is

$2^{-52} \approx 2.22\times 10^{-16}$

but the IEEE 754 format always expresses the significant such that the first bit is 1 (by adjusting the exponent) and then doesn’t need to store that 1, giving us an extra bit of precision, so the machine epsilon is

$2^{-53} \approx 1.11\times 10^{-16}$

We already saw how to access the limits of the data type via std::numeric_limits. When we looked at machine epsilon, we saw that for a double it was about $$1.1\times 10^{-16}$$.

Note that this is a relative error, so for a number like 1000 we could only add 1.1e-13 to it before it became indistinguishable from 1000.

$\mbox{relative roundoff error} = \frac{|\mbox{true number} - \mbox{computer representation} |} {|\mbox{true number}|} \le \epsilon$

Note that there are varying definitions of machine epsilon which differ by a factor of 2.

### Range¶

Now consider the exponent, we use 11 bits to store it in double precision. Two are reserved for special numbers, so out of the 2048 possible exponent values, one is 0, and 2 are reserved, leaving 2045 to split between positive and negative exponents. These are set as:

$2^{-1022} \mbox{ to } 2^{1023}$

converting to base 10, this is

$\sim 10^{-308} \mbox{ to } \sim 10^{308}$

### Reporting values¶

We can use std::numeric_limits<double> to query these floating point properties:

Listing 53 limits.cpp
#include <iostream>
#include <limits>

int main() {

std::cout << "maximum double = " << std::numeric_limits<double>::max() << std::endl;
std::cout << "maximum double base-10 exponent = " << std::numeric_limits<double>::max_exponent10 << std::endl;
std::cout << "smallest (abs) double = " << std::numeric_limits<double>::min() << std::endl;
std::cout << "minimim double base-10 exponent = " << std::numeric_limits<double>::min_exponent10 << std::endl;
std::cout << "machine epsilon (double) = " << std::numeric_limits<double>::epsilon() << std::endl;

}

## Roundoff vs. truncation error¶

Consider the Taylor expansion of $$f(x)$$ about some point $$x_0$$:

$f(x) = f(x_0 + \Delta x) = f(x_0) + \left . \frac{df}{dx} \right |_{x_0} \Delta x + \mathcal{O}(\Delta x^2)$

where $$\Delta x = x - x_0$$

We can solve for the derivative to find an approximation for the first derivative:

$\left . \frac{df}{dx} \right |_{x_0} = \frac{f(x_0 + \Delta x) - f(x_0)}{\Delta x} + \mathcal{O}(\Delta x)$

This shows that this approximation for the derivative is first-order accurate in $$\Delta x$$ – that is the truncation error of the approximation.

We can see the relative size of roundoff and truncation error by using this approximation to compute a derivative for different values of $$\Delta x$$:

Listing 54 truncation_vs_roundoff.cpp
#include <iostream>
#include <iomanip>
#include <cmath>
#include <limits>
#include <vector>

double f(double x) {
return std::sin(x);
}

double dfdx_true(double x) {
return std::cos(x);
}

struct point {
double dx;
double err;
};

int main() {

double dx = 0.1;
double x0 = 1.0;

std::vector<point> data;

while (dx > std::numeric_limits<double>::epsilon()) {

point p;
p.dx = dx;

double dfdx_approx = (f(x0 + dx) - f(x0)) / dx;
double err = std::abs(dfdx_approx - dfdx_true(x0));

p.err = err;

data.push_back(p);

dx /= 2.0;
}

std::cout << std::setprecision(8) << std::scientific;

for (auto p : data) {
std::cout << std::setw(10) << p.dx << std::setw(15) << p.err << std::endl;
}
}

It is easier to see the behavior if we make a plot of the output:

Let’s discuss the trends:

• Starting with the largest value of $$\Delta x$$, as we make $$\Delta x$$ smaller, we see that the error decreases. This is following the expected behavior of the truncation error derived above.

• Once our $$\Delta x$$ becomes really small, roundoff error starts to dominate. In effect, we are seeing that:

$(x_0 + \Delta x) - x_0 \ne 0$

because of roundoff error.

• The minimum error here is around $$\sqrt{\epsilon}$$, where $$\epsilon$$ is machine epsilon.

## Testing for equality¶

Because of roundoff error, we should never exactly compare two floating point numbers, but instead ask they they agree within some tolerance, e.g., test equality as:

$| x - y | < \epsilon$

For example:

Listing 55 comparing.cpp
#include <iostream>

int main() {

double h{0.01};
double sum{0.0};

for (int n = 0; n < 100; ++n) {
sum += h;
}

std::cout << "sum == 1:        " << (sum == 1.0) << std::endl;
std::cout << "|sum - 1| < tol: " << (std::abs(sum - 1.0) < 1.e-10) << std::endl;

}

## Minimizing roundoff¶

Consider subtracting the square of two numbers – taking the difference of two very close-in-value numbers is a prime place where roundoff can come into play.

$x^2 - y^2$

$(x - y)(x + y)$

by factoring this, we are subtracting more reasonably sized numbers, reducing the roundoff.

We can see this directly by doing this with single precision (float) and comparing to an answer computed via double precious (double)

Here’s an example:

Listing 56 subtraction.cpp
#include <iostream>

int main() {

float x{1.000001e15};
float y{1.0000e15};

std::cout << "x^2 - y^2 :      " << x*x - y*y << std::endl;
std::cout << "(x - y)(x + y) : " << (x - y) * (x + y) << std::endl;

double m{1.000001e15};
double n{1.0000e15};

std::cout << "double precision value: " << (m - n) * (m + n) << std::endl;

}

As another example, consider computing 1:

$\sqrt{x + 1} - \sqrt{x}$

We can alternately rewrite this to avoid the subtraction of two close numbers:

$\sqrt{x + 1} - \sqrt{x} = (\sqrt{x + 1} - \sqrt{x}) \left ( \frac{\sqrt{x+1} + \sqrt{x}}{\sqrt{x+1} + \sqrt{x}} \right ) = \frac{1}{\sqrt{x+1} + \sqrt{x}}$

Again we’ll compare a single-precision calculation using each of these methods to a double precision “correct answer”. To ensure that we use the single-precision version of the std::sqrt() function, we will use single precision literal suffix, e.g., 1.0f tells the compiler that this is a single-precision constant.

Listing 57 squareroots.cpp
#include <iostream>
#include <iomanip>

#include <cmath>

int main() {

float x{201010.0f};

std::cout << std::setprecision(10);

float r1 = std::sqrt(x + 1.0f) - std::sqrt(x);

float r2 = 1.0f / (std::sqrt(x + 1.0f) + std::sqrt(x));

std::cout << "r1 = " << r1 << " r2 = " << r2 << std::endl;

double xd{201010.0};

double d = std::sqrt(xd + 1.0) - std::sqrt(xd);

std::cout << "d = " << d << std::endl;
}

Notice that we get several more significant digits correct when we compute it with the second formulation compared to the original form.

### Summation algorithms¶

Summing a sequence of numbers is a common place where roundoff error comes into play, especially if the numbers all vary in magnitude and you do not attempt to add them in a sorted fashion. There are a number of different summation algorithms that keep track of the loss due to roundoff and compensate the sum, for example the Kahan summation algorithm.

## Special numbers¶

IEEE 754 defines a few special quantities:

• NaN (not a number) is the result of 0.0/0.0 or std::sqrt(-1.0)

• Inf (infinity) is the result of 1.0/0.0

• -0 is a valid number and the standard says that -0 is equivalent to 0

## Trapping floating point exceptions¶

What happens when we do something bad? Consider this example:

Listing 58 undefined.cpp
#include <iostream>
#include <cmath>

double trouble(double x) {
return std::sqrt(x);
}

int main() {

double x{-1};

double y = trouble(x);

for (int i = 0; i < 10; ++i) {
y += std::pow(x, i);
}

std::cout << y << std::endl;

}

Here, we pass -1 to trouble() which then takes the square root of it – this results in a NaN. But if we run the code, it goes merrily about its way, using that result in the later computations.

Unix uses signals to indicate that a problem has happened during the code execution. If a program created a signal handler then that signal can be trapped and any desired action can be taken.

Note

This example was only tested on a Linux machine with GCC. Other OSes or compilers might have slightly different headers or functionality.

There are a few parts to trapping a floating point exception (FPE). First we need to enable exception trapping via:

feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);

That catches 3 different types of floating point exceptions – invalid, divide-by-zero, and overflows.

Next we need to add a handler to deal with the exception:

signal(SIGFPE, fpe_handler);

Here, SIGFPE is the standard name for a floating point exception, and fpe_handler is the name of a function that will be called when we detect a SIGFPE.

In our handler, we use the Linux backtrace() function to access the stack of our program execution. This is really a C-function, so we need to use C-style arrays here.

Here’s the new version of our code:

Listing 59 undefined_trap.cpp
#include <iostream>
#include <cmath>
#include <csignal>
#include <cfenv>
#include <execinfo.h>

void fpe_handler(int s) {
std::cout << "floating point exception, signal " << s << std::endl;

const int nbuf = 64;
void *bt_buffer[nbuf];
int nentries = backtrace(bt_buffer, nbuf);
char **strings = backtrace_symbols(bt_buffer, nentries);

for (int i = 0; i < nentries; ++i) {
std::cout << i << ": " << strings[i] << std::endl;
}

abort();
}

double trouble(double x) {
return std::sqrt(x);
}

int main() {

feenableexcept(FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);

signal(SIGFPE, fpe_handler);

double x{-1};

double y = trouble(x);

for (int i = 0; i < 10; ++i) {
y += std::pow(x, i);
}

std::cout << y << std::endl;

}

When we compile the code, we want to add the -g option to store the symbols in the code – this allows us to understand where problems arise:

span.prompt1:before {
content: "\$ ";
}
g++ -g -o undefined_trap undefined_trap.cpp

Now when we run this, the program aborts and we see:

floating point exception, signal 8
0: ./undefined_trap() [0x401261]
1: /lib64/libc.so.6(+0x42750) [0x7f3dc35dc750]
2: /lib64/libm.so.6(+0x1435c) [0x7f3dc37d335c]
3: ./undefined_trap() [0x4012ff]
4: ./undefined_trap() [0x401347]
5: /lib64/libc.so.6(+0x2d560) [0x7f3dc35c7560]
6: /lib64/libc.so.6(__libc_start_main+0x7c) [0x7f3dc35c760c]
7: ./undefined_trap() [0x401145]
Aborted (core dumped)

This is the call stack for our program. In the brackets are the address in the program where the execution was when the FPE occurred. These are ordered such that the calling function is below the function where the execution is. So it usually is best to look at the addresses near the top.

We can turn those into line numbers using addr2line:

addr2line  -e undefined_trap 0x4012ff

gives:

/home/zingale/classes/phy504/examples/floating_point/undefined_trap.cpp:23

and that line is precisely where the sqrt() is!

We can get slightly nicer output (including the function name) by doing:

addr2line  -C -f -i -p -e undefined_trap 0x4012ff

which gives:

trouble(double) at /home/zingale/classes/phy504/examples/floating_point/undefined_trap.cpp:23

Note

On the MathLab machines, the stack trace seems to include an offset, like:

floating point exception, signal 8
0: ./undefined_trap(+0xc03) [0x561d8799dc03]
1: /lib/x86_64-linux-gnu/libc.so.6(+0x3ef10) [0x7f5461e3df10]
2: /lib/x86_64-linux-gnu/libm.so.6(+0x11397) [0x7f5462201397]
3: ./undefined_trap(+0xccf) [0x561d8799dccf]
4: ./undefined_trap(+0xd21) [0x561d8799dd21]
5: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f5461e20c87]
6: ./undefined_trap(+0xaaa) [0x561d8799daaa]
Aborted (core dumped)

and we need to use that offset instead with addr2line, like:

addr2line -a -f -e ./undefined_trap +0xcd5

1

this example is based on Yakowitz & Szidarovszky


When does improper Riemann integration fail for computing expected values?

Riemann integration requires bounded intervals of integration. However, some continuous random variables (like those from the normal or gamma distribution) have unbounded support sets.

For these 2 distributions, would improper Riemann integrals be sufficient to get their expected values? If not, why not?

Usually, improper Riemann integration will correctly provide the expectation of a continuous random variable with an unbounded support. Where you will usually encounter problems with improper Riemann integrals is when the integral of interest does not converge absolutely. In this case the improper integral may have some value, but this value has limited probabilistic meaning; for example the law of large numbers doesn't necessarily hold.

As an example of this to get a feel for it, you can look at the evaluation of the expected value of $$X \sin(X)$$ where $$X$$ has PDF $$\frac{1}{x^2}$$ on $$[1,\infty)$$ and $$0$$ otherwise. This expectation is formally $$\int_1^\infty \frac{\sin(x)}{x} dx$$ which has a value in improper Riemann integration. But actually this random variable will not satisfy the law of large numbers, as you can observe numerically, so it doesn't make a whole lot of sense to say that it has an expected value.

Indeed, if you have Matlab or Octave, try running the following:

x=1./rand(1000,1);
plot(cumsum(x.*sin(x))./(1:1000)');

This shows sample means from this distribution for progressively larger samples, and you see that they don't converge. (Off-topic: the weird 1/rand trick being used there is called the probability integral transformation, which is extremely useful for numerical work in probability.)

Note that this will never be a problem for a random variable of one sign such as your example of the Gamma distribution. It is also not a problem for the normal distribution.

The exception to the second "usually" above is when the improper Riemann integral doesn't exist but the Lebesgue integral does. This is a pretty uncommon situation in practice.

• @Iterator516 No, the integrals in both of those cases converge absolutely. – Ian Oct 30 at 15:30
• Awesome! Thank you! – Iterator516 Oct 30 at 15:30
• I mistakenly deleted my initial question to Ian. I asked if the integrals for the expectations of the normal and the gamma distributions do converge. – Iterator516 Oct 30 at 16:29


# Greatest Common Divisor of prime numbers

What is the greatest common divisor of $2^4\cdot3^4\cdot25\cdot7$ and $2\cdot12^2\cdot15$?

I know how to find the GCD of a problem like this, but I didn't know what to do since $12$ is not a prime number. Should I say $12^2 = 2^2\cdot2^2\cdot3^2$?

• Hint: $12^2 = (2^2*3)^2 = 2^4*3^2$ – AnalyticHarmony Sep 18 '17 at 2:22
• that's a start. $12^2 =2^2*2^2*3^2=2^4*3^2$. And $15=3*5$ so $12^2*15=2^4*3^2*3*5 = 2^4*3^3*5$. Basically the first step is to rewrite everything as its unique prime factorization. $2^4*3^4*25*7 = 2^4*3^4*5^2*7$ and $2*12^2*15 = 2*2^4*3^2*3*5=2^4*3^3*5$. Then... you know what to do. – fleablood Sep 18 '17 at 3:49

The first one equal to $2^4*3^4*5^2*7$

The second one equals to $2^5*3^3*5$

Therefore the GCD is $2^4*3^3*5=2160$

Yes, that is precisely what you should be doing.

In short, when you want to find the gcd of two numbers directly, you must first represent each one as a product of prime powers, before matching powers and primes.

So in our case, we can write: $$2^4 \times 3^4 \times \color{blue}{25} \times 7 = 2^4 \times 3^4 \times \color{blue}{5^2} \times 7 \\ 2 \times \color{red}{12^2} \times \color{green}{15} = 2 \times \color{red}{2^2 \times 2^2 \times 3^2} \times \color{green}{3 \times 5} = 2^5 \times 3^3 \times 5$$

where, I highlight by color the terms that are expanded on both the LHS and RHS.

Now, we are permitted to compare powers directly. This gives us the answer as $2^4 \times 3^3 \times 5$.

• Nicely explained and nice use of colors. The OP should note when you express a number and a product of prime powers, there will always be exactly one unique way to do it. So doing this will always be a failsafe that will work. – fleablood Sep 18 '17 at 3:54


# Eigenvalues of block Toeplitz matrix with Toeplitz blocks

Consider integers $$m,n$$ and a $$m \times m$$-block Toeplitz matrix $$A$$ consisting of two different types of blocks as follows

\begin{align} A_{mn \times mn} &= \begin{bmatrix} B & C & C & \cdots & \cdots & C \\ C & B & C & C & \cdots & C \\ C & C & B & C & \ddots & \vdots \\ \vdots & \ddots & \ddots & \ddots & \ddots & C \\ C & \cdots & \cdots & C & B & C \\ C & \cdots & \cdots & \cdots & C & B \end{bmatrix} _{mn \times mn} , \end{align}

where $$B$$'s are diagonal blocks with $$B=\frac{1}{m}I_n$$ and $$C$$'s are multiples of the all-ones matrix $$J_n$$, specifically $$C=\frac{1}{mn}J_n$$.

I want to compute the eigenvalues of $$A$$ (I am mainly interested in the value of the 2nd largest eigenvalue since it has a special meaning in graph expansion applications).

Note that in my problem the following conditions also hold for $$m,n$$:

• $$m$$ is odd.
• $$n$$ is prime.
• $$m.

I have experimented with such matrices on the computer and I have observed a trend for the spectrum of $$A$$ which consists of the following eigenvalues:

• $$\lambda_1=0$$ with algebraic multiplicity $$m-1$$.
• $$\lambda_2=1/m$$ with algebraic multiplicity $$m(n-1)$$.
• $$\lambda_3=1$$ with algebraic multiplicity $$1$$.

I do not claim that this is necessarily the answer but at least it was consistent for the pairs of $$m,n$$ I tried.

Can you suggest how one can go and prove the above claim (if correct) or pinpoint other known results?

EDIT

After Omnomnomnom's note that $$$$A = \frac 1{mn}\underbrace{\pmatrix{ 0&1&\cdots & 1\\ 1&0&\ddots&\vdots\\ \vdots&\ddots&\ddots&1\\ 1&\cdots&1&0}}_{= C_{m \times m}} \otimes J_n + \frac 1m I_{mn}$$$$

I did some computation of the spectrums of the individual matrices. First, the characteristic polynomial of the all-ones $$J_n$$ is $$(\lambda-n)\lambda^{n-1}$$ and hence its spectrum (with the multiplicities) is $$$$\sigma(J_n)=\{(n,1),(0,n-1)\}.$$$$ For $$C$$, assume that $$\lambda_1,\dots,\lambda_m$$ are its eigenvalues. By the facts that $$\mathrm{det}(C-(-1)I_m)=det(J_m)=0$$, $$C\mathbf{1}_m=(m-1)\mathbf{1}_m$$ and $$\mathrm{trace}(C)=\sum_i\lambda_i=0$$ it turns out that $$$$\sigma(C)=\{(m-1,1),(-1,m-1)\}.$$$$ Suppose that $$\mu_1,\dots,\mu_n$$ are the eigenvalues of $$J_n$$ then by the Kronecker product's properties the spectrum of $$CJ_n$$ consists of the pairwise products $$\lambda_i\mu_j, \forall i,j$$.

Your observations are correct and hold for arbitrary $$m,n$$. It suffices to note that $$A = \frac 1{mn}\pmatrix{ 0&1&\cdots & 1\\ 1&0&\ddots&\vdots\\ \vdots&\ddots&\ddots&1\\ 1&\cdots&1&0} \otimes J_n + \frac 1m I_{mn}$$ and use the properties of the Kronecker product.

In more detail: $$C_{m \times m}$$ is a rank 1 update of a scalar matrix, so we find that its eigenvalues are $$-1$$ with multiplicity $$m-1$$ and $$m-1$$ with multiplicity $$1$$. On the other hand, $$J_n$$ has eigenvalues $$0$$ with multiplicty $$n-1$$ and $$n$$ with multiplicity $$1$$.

It follows that $$C \otimes J$$ has eigenvalues $$0$$ with multiplicity $$m(n-1)$$, $$-n$$ with multiplicity $$m-1$$, and $$n(m-1)$$ with multiplicity $$1$$.

From there, it suffices to note that $$\lambda$$ is an eigenvalue of $$A$$ if and only if $$c \lambda + d$$ is an eigenvalue of $$c A + dI$$.

• I have made some edits based on your response (please see edit). However, the resulting sum of the Kronecker product and the diagonal matrix confuses me. How can I proceed?
– mgus
Mar 5 '20 at 3:35
• @mgus I'll add in what I had in mind when I have the chance Mar 5 '20 at 10:08
• See my latest edit Mar 5 '20 at 14:21
• Thanks for your response. Now it is clear to me except one thing: if the spectrums of $C$ and $J_n$ are indeed $\sigma(C)=\{(m-1,1),(-1,m-1)\}$ and $\sigma(J_n)=\{(n,1),(0,n-1)\}$, respectively then where is the eigenvalue $-n(m-1)$ of $C \otimes J$ is coming from? I thought it would be $n(m-1)$ with multiplicity $1$. After doing the remaining of the calculations for the eigenvalues of $A$ it seems that this should be true but how? Am I missing some plus or minus somewhere?
– mgus
Mar 5 '20 at 17:37
• @mgus You're right about $n(m-1)$; I just had an extra minus sign there. Mar 5 '20 at 17:39


# Optimization of the area of a cross inscribed in a circle

I've really been scratching my head over this optimization problem. "Consider a symmetric cross inscribed in a circle of radius $r$." The length from the center of the cross to the middle of one of its arms is $x$. Also, the angle between two line segments drawn from the cross's center to the vertices of one of its arms has a measure of $\theta$. Here's a diagram:

There are three parts to the problem: "(a) Write the area $A$ of the cross as a function of $x$ and find the value of $x$ that maximizes the area. (b) Write the area $A$ of the cross as a function of $\theta$ and find the value of $\theta$ that maximizes the area. (c) Show that the critical numbers of parts (a) and (b) yield the same maximum area. What is that area?"

So, let me show you what I've done so far. For part (a), I decided to break the cross into two middle rectangles and two side rectangles. I saw that a middle rectangle (from the center to the top) would have an area of

$$x \cdot 2 \sqrt{r^2 - x^2}$$

using the Pythagorean theorem. I worked out that a side rectangle (the remaining area on the right, adjacent to the middle rectangles) would have an area of

$$2 \sqrt{r^2-x^2} \cdot \left( x - \sqrt{r^2 - x^2} \right) .$$

So, the area of the cross is

$$A = 2 \bigg( x \cdot 2 \sqrt{r^2 - x^2} + 2 \sqrt{r^2 - x^2} \cdot \Big( x - \sqrt{r^2 - x^2} \Big) \bigg) = 8x \sqrt{r^2 - x^2} - 4r^2 + 4x^2 .$$

If my math is right there (fingers crossed), then I'll take the first derivative to locate a maximum.

$$A^\prime = 8 \sqrt{r^2 - x^2} + 8x \left( 1 \over 2 \right) \left( r^2 - x^2 \right)^{- {1 \over 2}} \left( -2x \right) + 8x.$$

I was a little unsure about what to do at this point. I plugged the $A^\prime$ equation into my graphing calculator, substituting $1^2$ for $r^2$ (for a radius of $1$). The graph crosses the $x$-axis at $x \approx 0.85$. Substituting $2^2$ for $r^2$ (for a radius of $2$) gives me $x \approx 1.70$. From this, I concluded that

$$A^\prime = 0 \; \mathbf{at} \; x \approx 0.85r.$$

Analysis of graphs of $A$ for various values of $r$ concludes that, indeed, maxima do appear at $x \approx 0.85r$. So, I have the function $A$ in terms of $x$, but I'm curious: What should my final answer be for the second part of (a)? All I have is $x \approx 0.85r$. Is that a sufficient answer?

As for part (b), I really have no idea how to write $A$ in terms of $\theta$. I know that $\text{area} = {1 \over 2} b \cdot c \cdot \sin A$ for triangles, but I really need help writing the area of this cross in terms of $\theta$.

Part (c) should be easy enough once I finish (b).

If you got to the end of this, I sincerely thank you for reading, and I would really appreciate an answer (and any corrections to my math). Thanks!

-
You can simplify the formula for $A'$ if you set it to zero and multiply with $\sqrt{1-x^2}$ (with $r=1$). In this way you get $0=1-2x^2+8x\sqrt{1-x^2}$. This is still tricky, but you might want to try a tailor expansion until $x^2$ to simplify further. – Konstantin Schubert Dec 18 '12 at 1:07
@Konstantin I computed $x\sqrt{1-x^2}=2x^2-1$. Square both sides and you have a quadratic in $x^2$. The solutions are $x^2={1\over2}\pm{\sqrt5\over10}$. – David Mitra Dec 18 '12 at 1:22
@DavidMitra aww thanks – Konstantin Schubert Dec 18 '12 at 1:28

Without loss of generality we may assume that the radius is $1$: we can scale area by $r^2$ later.

By the formula you quoted, the area of the triangle enclosed by the two lines that form the angle $\theta$ is $\frac{1}{2}\sin\theta$. The area covered by one of the two full arms of the cross is therefore $4$ times this, which is $2\sin\theta$.

Double this to get the sum $4\sin\theta$ of the areas covered by the two full arms. Unfortunately, this sum counts the area of the middle square twice. So we will need to subtract the area of that square.

Note that by trigonometry, the horizontal segment at the top of the cross has length $2\sin(\theta/2)$. Thus the middle square has area $4\sin^2(\theta/2)$. Using the trigonometric identity $\cos 2\phi=1-2\sin^2\phi$, we find that the middle square has area $2-2\cos \theta$.

So the area of the cross is $4\sin\theta +2\cos\theta-2$. Maximizing should be straightforward.

Remarks: $1.$ We don't really need calculus. Look at the equivalent problem of maximizing $4\sin\2\theta+2\cos\theta$. Rewrite this as $$2\sqrt{5}\left(\frac{2}{\sqrt{5}}\sin \theta+\frac{1}{\sqrt{5}}\cos\theta\right),$$ and let $\psi$ be the angle whose cosine is $2/\sqrt{5}$ and whose sine is $1/\sqrt{5}$. Then our expression becomes $2\sqrt{5}\sin(\theta+\psi)$. The maximum possible value of the sine function is $1$. So the maximum area is $2\sqrt{5}-2$.

$2.$ We can use the above calculation to answer your question about $x$. Alternately, set the derivative equal to $0$, as you did. Manipulation will yield an explicit expression for the root.

$3.$ At a certain stage you were maximizing $8x\sqrt{r^2-x^2}-4r^2+4x^2$. Let $x=r\sin t$. We want to maximize $8r^2\sin t\cos t-4r^2+4r^2\sin^2 t$. Forget about the $r^2$ part, it is a constant multiplier. Now simplify to $8\sin t\cos t-4\cos^2 t$, differentiate. (Using double angle identities to simplify first is a good idea.) We can think of this as just a technical device to ensure we end up with a simple equation.

-
Could you show me how $\sqrt{2 - 2\cos\theta} = 2\sin(\theta/2)$? – Jackson Dec 18 '12 at 1:44
Recall the trig identity $\cos 2t=2\cos^2 t-1=1-2\sin^2 t$. Rewrite as $2\sin^2 t=1-\cos 2t$. Double. Get $4\sin^2 t=2-2\cos 2t$. Finally, let $t=\theta/2$. – André Nicolas Dec 18 '12 at 1:47
Thank you so much! It took me a while, but I got everything figured out. I cannot thank you enough :) – Jackson Dec 18 '12 at 2:07
I will add a last remark to my post in a few minutes. – André Nicolas Dec 18 '12 at 2:15

I'm trying to solve the same problem, and got to the same concusions. The thing is, if you graph the function you get this :

as you can see, the graph takes negative values when x gets smaller, but if the function represents the area of the cross, how come that area is negative ??

I even made a little program to test this, here it is: http://www.khanacademy.org/cs/calculus-maxarea-circle-v00x/1512261081

does anybody have an idea of what's going on ?

-


# Easiest way to learn exact values for trig functions?

1. Oct 30, 2015

### cmkluza

I'm realizing now how much I need to know the exact values of various trigonometric functions, as shown in various trig tables. Memorizing is pretty arduous, and I'd prefer to understand it, so how can I learn all of these?

2. Oct 30, 2015

### Staff: Mentor

A long long time ago, my math teacher made us build our own trigonometric circles. Having a geometrical representation really helped me, and the values of the functions have stuck with me ever since.

3. Oct 30, 2015

### cmkluza

Thanks! I guess I'd forgotten that these circles existed. Does this mean that if I memorize the important angles/values from the first quadrant I can use the identities of -sin(θ) = sin(-θ) and cos(-θ) = cos(θ) to figure out the values in each other quadrant?

4. Oct 30, 2015

### Staff: Mentor

It's even more than that. Consider for instance π/6 (30°): you get halfway up on the y axis, so obviously sin π/6 = 1/2. Likewise, for π/4, you can see it as building a square of side 1/2 (along x and y), so the diagonal is (according to Pythagoras) $\sqrt{(1/2)^2 + (1/2)^2} = 1/\sqrt{2} = \sqrt{2}/{2}$. All of these geometric equivalents have really helped me.

5. Oct 30, 2015

### symbolipoint

That graphical circle representation is typically called, the Unit Circle, and is a very important part of Trigonometry instruction. Is is used frequently. The picture can often help because of how the circle is symmetric. Full ray rotation, 2*pi radians. Same function values as for zero degrees rotation.

6. Oct 30, 2015

### cmkluza

What would you guys say are the most important angles to learn? I've seen some charts that go from 0, adding π/12 each segment, and that seems like an awful lot to go through in order to find these angles, are the three, π/6, π/4, and π/3 and their counterparts typically sufficient?

7. Oct 30, 2015

### symbolipoint

THE MOST COMMON you must know are 0, 2*pi, pi/2, pi/4, pi/3, pi/6.

8. Oct 30, 2015

### Staff: Mentor

I realize that this might not be as clear as it can be. Rather, take the radius as the hypotenuse of a right triangle with two equal sides of length $a$ (along the x and y axes), so by Pythagoras $2a^2 = 1 \Rightarrow a = 1/\sqrt{2}$, thus $\cos \pi/4 = \sin \pi/4 = \sqrt{2}/2$.

9. Oct 30, 2015

### Staff: Mentor

πTo expand on what symbolipoint said, the important angles in the first quadrant, and their sines and cosines are:
$\sin(0) = \frac {\sqrt{0}} 2 =\cos(\pi/2)$
$\sin(\pi/6) = \frac {\sqrt{1}} 2 =\cos(\pi/3)$
$\sin(\pi/4) = \frac {\sqrt{2}} 2 =\cos(\pi/4)$
$\sin(\pi/3) = \frac {\sqrt{3}} 2 =\cos(\pi/6)$
$\sin(\pi/2) = \frac {\sqrt{4}} 2 =\cos(0)$
These values should be memorized, but you can use symmetry to figure out the sines, cosines, tangents, etc. of the counterparts of these angles in the other three quadrants.

10. Oct 30, 2015

Staff Emeritus
There are 7 special angles worth memorizing:0, 15, 30, 45, 60, 75 and 90. Sines going up are cosines coming down. Tangent=sine/cosine may be a bit slow for calculating in your head for 15 and 75, and arguably 30 and 60, but the other three are trivial. So you have at most 10 - possibly 8 - facts to remember. That shouldn't be too arduous.

11. Oct 30, 2015

### Student100

Another method that may help you should you forget is to draw a picture and use geometry/trig:

From my poorly drawn circle you can see you want to find the point, (x, y) on the unit circle that intersects with a line of the radial length drawn 30 degrees from the origin. The right triangle formed by hypotenuse (which is our radius of 1) forms a special 30, 60, 90 triangle. A property of such a triangle is that the hypotenuse is twice the length of the shorter leg, and the longer leg is $\sqrt{3}$ times the length of the shorter leg. Since the hypotenuse is one, the length of the shorter leg, $y=\frac{1}{2}$ and the longer leg, x is $\sqrt{3}$ times more so, $x=\frac{\sqrt{3}}{2}$. So the $sin(30)=\frac{1}{2}$ while the $cosine(30)=\frac{\sqrt{3}}{2}$

You can repeat the same logic for 60 degrees, or just realize that the x and y's are swapped. For a 45-45-90 triangle, the legs are congruent, so the hypotenuse is $\sqrt{2}$ the length of either leg. So lets say the hypotenuse has length $x\sqrt{2}$ in this case, since we know the length to be one, we can simply say $x\sqrt{2}=1$ or $x=\frac{1}{\sqrt{2}}$. The legs are congruent so $y=\frac{1}{\sqrt{2}}$.

For 15 and 75 degrees you can use $sin(45-30)$ and solve using trig rules. For 0 and 90 you can again draw a line from the origin to the corresponding point on the circle and see either, x=1 in the case of an angle of 0, or x=0 in the case of an angle of 90 or vice versus.

Not sure if this will help or not, hopefully it'll allow you to re-derive these values should you forget them on a test.

12. Oct 30, 2015

### symbolipoint

The common reference angles that are learned on the Unit Circle come from a couple of Special Triangles.

13. Nov 4, 2015

### rs1n

If you look at the picture here: http://etc.usf.edu/clipart/43200/43216/unit-circle8_43216_lg.gif you will see that only the first quadrant is needed (and even then, only the angles between 0 and 45 degrees are needed (everything else can be derived by symmetry of the circle. As for the coordinates, I find it easier to remember them as:

0: $\left( \sqrt{\frac{4}{4}}, \sqrt{\frac{0}{4}}\right)$
pi/6: $\left( \sqrt{\frac{3}{4}}, \sqrt{\frac{1}{4}}\right)$
pi/4: $\left( \sqrt{\frac{2}{4}}, \sqrt{\frac{2}{4}}\right)$
pi/3: $\left( \sqrt{\frac{1}{4}}, \sqrt{\frac{3}{4}}\right)$
pi/2: $\left( \sqrt{\frac{0}{4}}, \sqrt{\frac{4}{4}}\right)$

14. Nov 5, 2015

### Erland

Easiest way is to use to draw a half square and a half equiliteral triangle, and use the Pythagorean theorem to obtaim sin, cos and tan for the angles in tjose triangles, i.e. 45, 30 and 60 degrees.

15. Nov 5, 2015

### Fredrik

Staff Emeritus
And once you have those, you can use them to find the values for some other angles. For example,
\begin{align*}
&\sin 15=\sin(45-30)=\sin 45\cos 30-\cos 45\sin 30\\
&\sin 120=\sin(2\cdot 60)=2\sin 60\cos 60
\end{align*} The only thing worth committing to memory in my opinion, is (what Erland said) that you start with half a square and half an equilateral triangle.

16. Nov 5, 2015

### symbolipoint

The unit circle and its typically shown values can be easily memorized.

THIS here is essential:


Binomial coefficient real life example.

"At a university, $15$ juniors and $20$ seniors volunteer to serve as a special committee that requires $8$ members. A lottery is used to select the committee from among the volunteers. Suppose the chosen students consists of six juniors and two seniors.

(a) For a test of homogeneity, what are the expected counts?

This question I understand.

(b) If the selection had been random, what is the probability of the committee having exactly two seniors?

My answer was that the probability is binomial, with Binom$(k=2, n=8, p=0.57)$, but this is apparently wrong. Instead the correct answer is: $$\frac{\binom{20}{2}\binom{15}{6}}{\binom{35}{8}}$$.

Can anyone explain the difference between this and standard binomial distribution?

• I suppose that you made a type and that there are $15$ junior volunteers, not $13$. Am I right? – José Carlos Santos Jun 17 '18 at 7:12
• It's not a straight binomial since the trials are not independent. Knowing that the first choice was a senior changes the probability that the second was a senior. – lulu Jun 17 '18 at 7:12
• Ahh. Thanks! I understand now :-) – Mathe Jun 17 '18 at 7:20
• This is the hypergeometric distribution – Lord Shark the Unknown Jun 17 '18 at 7:21
• To be sure of useful answers, you should state null and alternative hypotheses for your 'test of homogeneity'. You don't have quite large enough expected counts for the chi-squared goodness-of-fit statistic to truly have a chi-squared distribution. // Using the hypergeometric distribution, it seems you are aiming at "Fisher's exact test' which you can google. – BruceET Jun 17 '18 at 8:04

The issue is that the trials are not independent from each other. Having chosen a junior first, for example, changes the probability of now choosing a senior.

You must look at how many ways are there to choose two seniors (which is exactly $\binom{20}{2}$) and how many ways are there to choose six juniors (which is exactly $\binom{15}{6}$) and multiply them. This gives you the overall number of valid arrangements.

To get the probability, simply divide by the number of overall arrangements possible (which is $\binom{35}{8}$).

• To get a p-value you also need to include the probabilities of more extreme cases. – BruceET Jun 17 '18 at 8:47

In case it is helpful, here is Minitab output for testing two proportions. It attempts a normal test (with a warning about sample sizes being too small) and does Fisher's exact test.

Test and CI for Two Proportions

Sample  X   N  Sample p
1       6  15  0.400000
2       2  20  0.100000

Difference = p (1) - p (2)
Estimate for difference:  0.3
95% CI for difference:  (0.0193759, 0.580624)
Test for difference = 0 (vs ≠ 0):  Z = 2.10  P-Value = 0.036

* NOTE * The normal approximation may be inaccurate for small samples.

Fisher’s exact test: P-Value = 0.051


# Calculation of transition probabilities of Markov Chain problem

In the step of learning Markov chains, I came across few questions from assignments on UTDallas website. Finding the transition probabilities seems a bit hard for me in this one particular question only. The question is

(Sec 7.3, page 355, #1) Consider a system with two components. We observe the state of the system every hour. A given component operating at time $n$ has probability $p$ of failing before the next observation at time $n + 1$. A component that was in a failed condition at time $n$ has a probability $r$ of being repaired by time $n + 1$, independent of how long the component has been in a failed state. The component failures and repairs are mutually independent events. Let $X_n$ be the number of components in operation at time $n$. The process $\{X_n, n = 0, 1, . . .\}$ is a discrete time homogeneous Markov chain with state space $I = \{0, 1, 2\}$.

a) Determine its transition probability matrix, and draw the state diagram.

b) Obtain the steady state probability vector, if it exists

Although the answers are given, but I cannot understand that on what basis the transition probabilities are calculated. Can someone help me in this...

I had the following guesses my ownself (which mostly proved to be wrong)

\begin{bmatrix} 1-r-r^2 & r & r^2\\ ??& ?? & r(1-p) \\ p^2 & ?? & ?? \end{bmatrix}

The actual solution that the website pose is following...

\begin{bmatrix} (1-r)^2 & 2r(1-r) & r^2\\ p(1-r)& pr + (1-p)(1-r) & r(1-p) \\ p^2 & 2p(1-p) & (1-p)^2 \end{bmatrix}

• Thanks Yes it is self-study question. What I am asking is not the solution since I am not taking this exam, I am trying to learn the probability, in general, and markov chains, in specific. Appreciate your comment @Tavrock. – Kashan Feb 25 '17 at 4:11
• I am looking if someone can help me to learn HERE how transition probabilities are calculated...Since to my understanding, transitional probabilities are different than normal probabilities... – Kashan Feb 25 '17 at 10:59
• Can you explain the reasoning behind your guesses? (Also, based on the last comment, do you know what a transition probability is?) – Juho Kokkala Feb 25 '17 at 14:27

Note that, there are two components and each of them individually could be either in working or failure state. Then the states of the Markov chain be designated as $ff$ both components failed, $wf$ one component working and one component failed, and $ww$ both components working. Given that, the components function independently of each other.

• If the chain is in state $ff$ at time $n$, at the next time point it could be in the state

• $ff$ with probability $(1-r)(1-r)=(1-r)^2$, as the probability of not being repaired by next time point is $(1-r)$;

• $wf$ with probability $2r(1-r)$, as it may be the first component
that was repaired or the the second component that was repaired, so
that only one of the two components will be working;

• $ww$ with probability $r^2$, if both the components got repaired.

• If the chain is in the state $wf$ at time $n$, then at the next time point it could be in the state

• $ff$ with probability $p(1-r)$, as the working component failed and the component requiring repair was not yet repaired;

• $wf$ with probability $pr+(1-p)(1-r)$, as the working component was
not failed and the component requiring repair is not repaired, so
that only one component is working, which has a probability
$(1-p)(1-r)$; or the component working at the previous time has
failed and the component requiring repair has got repaired, which has a probability $pr$; mutually exclusiveness of the events results in the required probability;

• $ww$ with probability $r(1-p)$, as the working component does not
require repair and the failed component got repaired.

• If the chain is in the state $ww$ at time $n$, then at the next time point it could be in the state

• $ff$ with probability $p^2$, as both components have failed;
• $wf$ with probability $2p(1-p)$, which is the sum of probabilities
of two mutually exclusive events, viz., the first component failed
and the second working or the first component working and the
second component failed;

• $ww$ with probability $(1-p)^2$, as both components are still
working.

Hence, the transition matrix:

\begin{equation*} P=\begin{array}{c|ccc} &ff & wf & ww\\ \hline ff & (1-r)^2& 2r(1-r) & r^2\\ wf & p(1-r) & pr+(1-p)(1-r) & r(1-p) \\ ww & p^2 & 2p(1-p) & (1-p)^2 \end{array} \end{equation*}

• Thanks.... Helped me a lot in developing understanding and brushing off some dust over my mind – Kashan Feb 26 '17 at 2:20


# Homework Help: Reduction of Order

1. Oct 24, 2014

### QuantumCurt

1. The problem statement, all variables and given/known data

Given - $$y_1(x)=sin(2x)$$, find a second linearly independent solution to $$y''+4y=0$$

2. Relevant equations

I'm using reduction of order to write a second solution as a multiple of the first solution. I think I've gotten to the right answer, my main question is in how I should write the general solution of the equation.

3. The attempt at a solution

Using the fact that $y_1(x)=sin(2x)$, and that $y_2(x)=vy_1(x)$ I'm writing a second solution as $$y_2(x)=vsin(2x)$$
Now taking the first and second derivatives I get $$y_2'(x)=v'sin(2x)+2vcos(2x)$$
and $$y_2''(x)=v''sin(2x)+4v'cos(2x)-4vsin(2x)$$

Now I substitute back into the original equation and get, $$v''sin(2x)+4v'cos(2x)=0$$

Now to reduce order; $z=v' and z'=v''$

Then substituting - $$z'sin(2x)+4zcos(2x)=0$$

Which leads to $$\frac{dz}{z}=-4cot(2x)dx$$

Integrating this to logarithms and then exponentiating etc. leads me to - $$z=csc^2(2x)$$

Since $z=v'$ I can substitute again
$$v=\int csc^2(2x)dx$$
$$v=-\frac{1}{2}cot(2x)$$

Now since $y_2(x)=vy_1(x)$, I can say that,
$$y_2(x)=[-\frac{1}{2}cot(2x)][sin(2x)]$$
which simplifies to
$$y_2(x)=-\frac{1}{2}cos(2x)$$

The formula for the general solution is $y(x)=c_1y_1(x)+c_2y_2(x)$. Given this fact, my general solution is written as - $$y(x)=c_1sin(2x)-\frac{1}{2}c_2cos(2x)$$

Now...my question -

Since $-\frac{1}{2}c_1$ is really just an arbitrary constant, can I write my general solution in terms of just a constant rather than a fraction times a constant? This would give me the solution of -
$$y(x)=c_1sin(2x)+c_2cos(2x)$$

Is this essentially the same solution, or would it be better to write it in terms of the negative fractional constant?

Any help would be much appreciated. :)

Last edited: Oct 24, 2014
2. Oct 24, 2014

### vela

Staff Emeritus
Just absorb the -1/2 into c2.

3. Oct 24, 2014

### QuantumCurt

Thank you. I figured that was the case, but I wanted to be sure.


# How to create a particular 5 x 5 square colour map of the mean value of data points

I am trying to create a specific type of colour map for some data. The data is in the form of a list with dimensions 300000 x 3, that is 300,000 sets of {x, y, n} where x and y are basically the $xy$ cartesian coordinates and n is a value either 0 or 1. Doing a list plot of the 300,000 points gives the following figure:

What I am trying to make is a colour map of this figure, that is made up of 5 x 5 evenly sized squares (so 25 all up), in which the colour-key denotes the mean of the n values of all the points within that square. Is this possible?

Please let me know if any additional information is needed,

## 1 Answer

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##]/nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];

cft = ChartingFindTicks[{0, nbins}, {0, 1}];
MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
FrameTicks -> {{cft, cft}, {cft, cft}}]

With nbins = 25 we get

• I take it that if I would like to increase the number of squares, I just alter that 5 in the second line? Also, I tried changing it to 25 and it looks good, but there are a lot of data ticks. Is it possible to maybe only show every second, or even third data tick? – Lagiacrus Feb 27 '18 at 18:38
• @Lagiacrus, right; changing 5 changes the number of bins. Re ticks, please see the updated version. – kglr Feb 27 '18 at 20:17
• So far the code appears to have been working well, but I just tried it for a similar situation in which the third element of the list can be either 0, 1, 2 or 3 (instead of the original 0 or 1) and in this case the binmeans never ends up with a value higher than 1. Is there a limit on the value that binmeans can take? – Lagiacrus Mar 3 '18 at 12:57
• @Lagiacrus, you can change {0, 2, 2} in the definition of binlists to {0,, 4, 4} if the third list can take values in {0,1,2,3}`. – kglr Mar 3 '18 at 14:00


# probability of N same type pairs from a heterogeneous group

There are 16 people: 8 males and 8 females. The people are randomly divided to pairs, each pair get the exact same mission. Let $$X$$ be the number of male-male pairs.

1. calculate $$P\{X=3\}$$
2. calculate $$P\{X=i\}$$ where $$i$$ is each value $$X$$ can take
3. find $$E[X]$$

for (1) there are $$\binom{8}{2,2,2,1,1}$$ ways to divide the males to 3 all male pairs and $$\binom{8}{2,2,2,1,1}$$ ways to divide the females to 3 all female pairs and there are 4 ways to pair the remaining males and females so I expected the probability to be $$P\{X=3\}=\frac{\binom{8}{2,2,2,1,1}\cdot \binom{8}{2,2,2,1,1} \cdot 4}{\binom{16}{2,2,2,2,2,2,2,2}} = \frac{\frac{8!}{8}\cdot \frac{8!}{8}\cdot 4}{\frac{16!}{2^8}}=\frac{8!^2\cdot 4\cdot 64 \cdot 4}{16! \cdot 64}=\frac{8!^2}{15!} \approx 0.0012$$ but it is incorrect so instead I tried, I choose 6 males and pair them in $$\binom{8}{6}\binom{6}{2,2,2}$$ and the 2 remaining males I have $$\binom{2}{1}\binom{8}{1}$$ and $$\binom{7}{1}$$ ways to pair with a female, and the remaining 6 females I have $$\binom{6}{2,2,2}$$ ways to pair so $$\frac{\binom{8}{6}\binom{6}{2,2,2}\binom{2}{1}\binom{8}{1}\binom{7}{1}\binom{6}{2,2,2}}{\binom{16}{2,2,2,2,2,2,2,2}}=\frac{\frac{8!}{16}\cdot 16 \cdot 7\cdot\frac{6!}{8}}{\frac{16!}{2^8}}=\frac{7!\cdot 7! \cdot 2^8}{16!}\approx 0.0003$$ which is also incorrect. I'm not sure how I can calculate $$P\{X=3\}$$ or any other $$P\{X=i\}$$

after reading @saulspatz's answer I found a possible solution: all possible pairing is given by $$\binom{16}{2,2,2,2,2,2,2,2}\cdot \frac{1}{8!}$$ because all the pairs have the same role but the same works for each of the 3 male-male or female-female pairs, hence $$\binom{6}{2,2,2}\cdot \frac{1}{3!}$$ and because the 2 male-female pairs also have the same role I get $$P\{X=3\}=\frac{\frac{\binom{8}{6}\binom{6}{2,2,2}}{3!}\frac{\binom{2}{1}\binom{8}{1}\binom{7}{1}}{2!}\frac{\binom{6}{2,2,2}}{3!}}{\frac{\binom{16}{2,2,2,2,2,2,2,2}}{8!}}=\frac{\frac{8!}{16\cdot 3!}\cdot \frac{16\cdot 7}{2!}\cdot\frac{6!}{8\cdot 3!}}{\frac{16!}{2^8 \cdot 8!}}=\frac{8!\cdot 7! \cdot 7!\cdot 2^8}{16!\cdot 3!\cdot 3!\cdot 2!}\approx 0.1740$$ and from here calculating $$P\{X=i\}$$ is the same and and there is no problem finding $$E[X]$$

• What is a mission and what role does it play in your question (if any)? Also, you say some results you calculated are incorrect. How do you know they are incorrect? (I am not saying they are correct, I am just pointing out that you made unsupported claims in your post.) – mathguy Nov 28 '20 at 16:34
• @mathguy I think the mission part is so that the order of the pairs doesn't matter. I have 4 possible answers and I need to choose one – CforLinux Nov 28 '20 at 16:48

The number of ways to divide the $$16$$ people is not pairs is not $$\binom{16}{2,2,2,2,2,2,2,2}$$ but $$\frac1{8!}\binom{16}{2,2,2,2,2,2,2,2}$$ To divide the people into pairs, arrange them into a line, and pair the first and second, the third and fourth, and so on. The order of the tow people in the pairs doesn't matter, so we have $$\frac{16!}{(2!)^8}$$ but also the order of the pairs themselves doesn't matter, so we must divide by $$8!$$.


# Describe the structure $\operatorname{Gal}(\mathbb{Q}(\zeta_4)/\mathbb{Q})$

I know that if $n$ is prime then $G=\operatorname{Gal}(\mathbb{Q}(\zeta_n)/\mathbb{Q}) \simeq \Bbb Z_{n-1}$

But I am unsure what $G$ is when $n$ is not prime. For example when $n=4$:

$\operatorname{Gal}(\mathbb{Q}(\zeta_4)/\mathbb{Q}) \simeq \Bbb Z_4^*$

What is the structure of the group $\Bbb Z_4^*$? I am guessing it is cyclic, but I do not know how to explicitly find its generators.

Also, what is the basis of $\mathbb{Q}(\zeta_4)$ over $\mathbb{Q}$? Is it $\{\zeta, ..., \zeta^4\}$?

For general $n$, the units of the ring $\Bbb Z/n\Bbb Z$, which I’ll write $(\Bbb Z/n\Bbb Z)^*$, do not form a cyclic group. For, when $n=p_1^{e_1}p_2^{e_2}\cdots p_m^{e_m}$, then $(\Bbb Z/n\Bbb Z)^*\cong(\Bbb Z/p_1^{e_1}\Bbb Z)^*\oplus(\Bbb Z/p_2^{e_2}\Bbb Z)^*\oplus\cdots\oplus(\Bbb Z/p_m^{e_m}\Bbb Z)^*$, the $p_i$ all being prime.

For odd primes $p$, $(\Bbb Z/p^e\Bbb Z)^*$ is always cyclic, but the structure of $(\Bbb Z/2^e\Bbb Z)^*$ is $C_2\oplus C_{2^{e-2}}$, where by $C_m$ I mean an abstract cyclic group of order $m$. (The explanation of why these groups have this structure is a story for another night.)

• Thank you. So if I we take $n=18=3^2 \times 2 \implies Gal(\mathbb{Q}(\zeta_{18}/\mathbb{Q}) \simeq \mathbb{Z}/9\mathbb{Z} \oplus \mathbb{Z}/2\mathbb{Z}$ – amiz9 Jun 2 '16 at 13:17
• Take $n=8=2^3 \implies Gal(\mathbb{Q}(\zeta_{8}/\mathbb{Q}) \simeq \mathbb{C_2} \oplus \mathbb{C_2}$? – amiz9 Jun 2 '16 at 13:19
• Are these correct? This is a nice classification - can you point me to somewhere where I can read more about the generators of these groups and their structure? Do all cyclotomic extension fields have a similar structure? – amiz9 Jun 2 '16 at 13:21
• Don’t forget that (in your notation) $\Bbb Z_2^*$ is trivial, not order two. In fact, $\Bbb Q(\zeta_{18})=\Bbb Q(\zeta_9)$. And yes, $\Bbb Z_8^*\cong C_2\oplus C_2$, generators $3$ and $7$. – Lubin Jun 2 '16 at 13:32
• Structure of $\Bbb Q(\zeta_n)$ should be in most books on algebraic number theory. – Lubin Jun 2 '16 at 13:35

I mean, $\zeta_4 = i$ so the extension has degree $2$, so the Galois group is a finite group of order $2$ and there's only one of those, $\Bbb Z/2\Bbb Z$. Like all quadratic extensions, the basis is $\{1, i\}= \{1,\sqrt{-1}\}$. If you want the exact structure, it's mercifully simple: $i\mapsto \overline{i}$ is the automorphism, i.e. complex conjugation is the only one.

• OK thanks, that all makes sense, except I am unsure why $\zeta_4=i \implies [\mathbb{Q}(\zeta_4) : \mathbb{Q}]=2$.. could you help me understand this please? And is the $i \rightarrow i$ the automorphism because $i \notin \mathbb{Q}$? Thanks – amiz9 Jun 2 '16 at 0:16
• Is it because the we must take $i$ to the power of $2$ to return back to our field $\mathbb{Q}$? – amiz9 Jun 2 '16 at 0:17
• @amiz9 that's one way to think of it, yeah. $\Bbb Q(i) \cong \Bbb Q[x]/(x^2+1)$. And look at the little bar over the $i$, it means complex conjugate. You can also think of it just as $i\mapsto -i$. – Adam Hughes Jun 2 '16 at 0:18
• ok thanks. So in general to find $Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q})$, we can calculate the minimal polynomial of $\zeta_n$ over $\mathbb{Q}$. The degree of this polynomial will be the order of our group. Is that right? – amiz9 Jun 2 '16 at 0:23
• it will always be $\varphi(n)$ so you don't really need the polynomial. Generally speaking all automorphisms are $\zeta_n\mapsto \zeta_n^k$ for $k\in\Bbb Z/n\Bbb Z^*$. In this case $i\mapsto i^3 = i\mapsto (i)^2\cdot i = -i$ is how it works. – Adam Hughes Jun 2 '16 at 0:25

If $\zeta_n$ is a primitive $n^{th}$ root of unity, then $$Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q}) \cong (\mathbb{Z}_n)^*.$$

What the elements of the group look like:

If $\sigma \in Gal(\mathbb{Q}(\zeta_n)/\mathbb{Q})$, then there is an $a \in \{1,2,\dots,n\}$ with $a$ relatively prime to $n$ such that $$\sigma(\zeta_n) = (\zeta_n)^a$$

For the structure of $(\mathbb{Z}_n)^*$, see Lubin's answer.

• Thank you. What can we say about the generators that generate these groups? – amiz9 Jun 2 '16 at 13:21


# Moment of inertia of a disk by integration

1. ### soopo

226
1. The problem statement, all variables and given/known data

Show that the moment of inertia of a disk is $0.5 mr^2$.

3. The attempt at a solution

$$I = \int R^2 dm$$

Using $dm = \lambda dr$ such that $m = \lambda r$:

$$= \int_{-r}^{r} R^2 \lambda dr$$
$$= \frac { \lambda } {3} ( 2r^3 )$$
$$= \frac {2} {3} (\lambda r ) (r^2)$$
$$= \frac {2} {3} M R^2$$

which should be the moment of inertia for a ring.

Integrating this from 0 to 2pii relative to the angle gives me $\frac {4} {9} m r^3 [/tex], which is wrong. How can you calculate the moment of inertia for a disk? 2. ### jdwood983 383 If you have a disc of radius $$r$$, how can you integrate from $$-r$$ to $$r$$? 3. ### jdwood983 383 The infinitesimal change in mass is given by $$dm=m\frac{dA}{A}=m\frac{2\pi r\,dr}{\pi R^2}=\frac{2m}{R^2}r\,dr$$ If you use that in your integral and integrate from $$0$$ to $$R$$, you should get the desired result. 4. ### soopo 226 Your result gives me a wrong result: $$I = \int R^2 dm$$ $$= \int R^2 \frac { 2m } {R^2} r dr$$ $$= \int_{0}^{r} 2mr dr$$ $$= [ m r^2 ]^{r}_{0}$$ $$= mr^2$$ The result shoud be $$I = .5 mr^2$$ 5. ### soopo 226 I set the null point to the center of the circle such that I am integrating from -r to r. I am not sure why I cannot do that. 6. ### jdwood983 383 If you set the origin to the center of the circle (which you should always try to do), the smallest value that $$r$$ can be is 0. So it is physically impossible to integrate from $$-r$$ to $$r$$, that is why you can't do it. 7. ### soopo 226 I am thinking of setting an axis which goes through the origin such that the zero point of the axis is at the origin. Going to right means to go towards $$r$$, while going to left means towards $$-r$$. Perhaps, you are thinking the situation in a polar coordinate system in which case you cannot have negative $$-r$$. I feel that it is possible to integrate from $$-r$$ to $$r$$ in a cartesian coordinate system. 8. ### jdwood983 383 If you want Cartesian coordinates, then you'll need two integrals: one over $$x$$ and one over $$y$$. While technically you have two integrals in polar, $$r\, \mathrm{and}\, \theta$$, one is already done for you and reduces the integration to just one term: $$r$$. This problem is by far easier in polar coordinates: $$\begin{array}{ll}I&=\int_0^R r^2\frac{2m}{R^2}rdr \\ &=\frac{2m}{R^2}\int_0^Rr^3dr \\ &=\frac{2m}{R^2}\left(\frac{R^4}{4}-0\right) \\ &=\frac{2m}{R^2}\cdpt\frac{R^4}{4} \\ &=\frac{1}{2}mR^2$$ 9. ### soopo 226 If you use symmetry, it is enough to consider only the first quadrant that is where x > 0 and y > 0 such that four of these quadrants form the area of the disk. You do not get the x- and y -coordinates easily from the definition of the moment of inertia. You would get $$I = \int (x^2 + y^2) dm \\ &= \int (x^2 + y^2) m \frac { 2r } {R^2} dr$$ The calculations seem to get challenging, since we need to use Pythogoras such that $$r = \sqrt{ x^2 + y^2 }$$ which implies $$dr = \frac { 1 } { \sqrt {x^2 + y^2} } * 2x$$ We can get similarly the relation relative to $$y$$. The next step is not fun at all: $$I = \int_{0}^{1} \sqrt {x^2 +y^2} (x+y) x dx$$, where I assume that [itex] R^2 = (x + y)^2 = (1 + 1)^2 = 4$, since it is the maximum radius.
This way the two 2s cancel out.

I do not even know how to integrate this!

Polar coordinate system really seems to be better in this case.

Last edited: Oct 27, 2009
10. ### jdwood983

383
Not quite. The integral you need is given by

$$I=\frac{m}{A}\int_{-R}^R\int_{-\sqrt{R^2-x^2}}^{\sqrt{R^2-x^2}}\left(x^2+y^2\right)dydx$$

$$I=\frac{m}{\pi R^2}\int_{-R}^R \frac{2\sqrt{R^2-x^2}\left(R^2+2x^2\right)}{3}dx$$

$$I=\frac{m}{\pi R^2}\cdot\frac{\pi R^4}{2}$$

$$I=\frac{mR^2}{2}$$

For most moment of inertia problems, spherical or cylindrical coordinates are the best.

11. ### soopo

226
How did you solve this part?

It has taken my some effort in trying to solve it by hand.

12. ### jdwood983

383
There's a few extra steps between the two lines, like making a change of variables. But to be honest I used Mathematica and just wrote the lines because I forget what changes needed to be made. While it may be good to know the form of the equation, I'm not sure you would need the solution since it is far easier to do it in polar coordinates than in Cartesian coordinates.