21

In the diagram, $\alpha$ and $\beta$ are independent uniformly random real numbers in $\left(0,\frac{\pi}{2}\right)$.

enter image description here

What is $\mathbb{E}(h)$?

Superimposing a cartesian coordinate system, the equations of the lines are $y=(\tan\alpha)x$ and $y=(-\tan\beta)(x-1)$, so the $y$-coordinate of their intersection is $\frac{(\tan\alpha)(\tan\beta)}{\tan\alpha+\tan\beta}$. So we have

$$\mathbb{E}(h)=\frac{4}{\pi^2}\int_0^{\pi/2}\int_0^{\pi/2}\frac{(\tan\alpha)(\tan\beta)}{\tan\alpha+\tan\beta} d\alpha d\beta$$

Desmos says $I=\int_0^{\pi/2}\int_0^{\pi/2}\frac{(\tan\alpha)(\tan\beta)}{\tan\alpha+\tan\beta} d\alpha d\beta$ is $(0.9999999913...)(\frac{\pi}{2})$. Is that a computer error, and the result is exactly $\frac{\pi}{2}$? I don't know how to evaluate the integral. Wolfram evaluates the inside integral but doesn't evaluate both integrals.

If Desmos is not very reliable, then maybe my earlier weird conjecture is actually true.

(This question was inspired by a question about random points in a square.)

Edit: In the comments, @G.Gare notes that Mathematica says the integral $I$ is exactly $\pi/2$. Can we prove it? Maybe an intuitive geometrical argument?

Edit2: I seek to generalize this result here.

Dan
  • 22,158
  • Is there a way to control the number of decimal places Desmos works with? Could you ask it to use 50 decimal places? – Gerry Myerson Nov 22 '23 at 11:51
  • 2
    Mathematica says it's $\pi/2$, but the indefinite integral is a mess – G. Gare Nov 22 '23 at 11:58
  • @GerryMyerson I don't know. – Dan Nov 22 '23 at 12:01
  • @G.Gare Thanks. I would very grateful if you could use Mathematica to check the linked conjecture: $\prod\limits_{k=1}^\infty\left(1+\int_{k}^{k+1}\left(\frac{\sin (\pi x)}{x}\right)^2\mathrm dx\right)\overset{?}{=}\pi/2$ – Dan Nov 22 '23 at 12:02
  • 1
    It's not giving a result for this one – G. Gare Nov 22 '23 at 12:06
  • @G.Gare What about the product of the first $10^{50}$ terms for example? – Dan Nov 22 '23 at 12:08
  • 1
    @Dan It seems you are interested in making conjectures, I would recommend register for Wolfram Cloud if possible, it's free. Someone on the site made the same suggestion to me. Also generally speaking Desmos loses a lot of precision while dealing with Double Integrals. – Miracle Invoker Nov 22 '23 at 12:08
  • @MiracleInvoker Thanks for the tip, I'll look into it. – Dan Nov 22 '23 at 12:08
  • For the product of the first whatever terms you can use any programming language... – G. Gare Nov 22 '23 at 12:13
  • 1
    It may help or not, but the integrand is equal to $\dfrac{\sin(\alpha) \sin(\beta)}{\sin(\alpha+\beta)}$ – Martin R Nov 22 '23 at 12:15
  • @MartinR I did the same calculation and tried on Mathematica, which now gives results faster – G. Gare Nov 22 '23 at 12:16
  • I have the explict formula for the integrals between $0$ and $t \leq \frac \pi 2$. – Claude Leibovici Nov 22 '23 at 12:49
  • 2
    With $(u,v)=\left(\frac{1-\tan x}{1+\tan x}, \frac{1-\tan y}{1+\tan y}\right)$ we get another integral identity for $\pi$,$$\int_{-1}^1\int_{-1}^1\frac{1-u}{1+u^2},\frac{1-v}{1+v^2},\frac{du,dv}{1-uv}=\pi$$Mathematica can compute this exactly, even over each quadrant. – user170231 Nov 22 '23 at 18:55
  • 2
    I’m surprised nobody cited this video by Grant Sanderson: https://www.youtube.com/watch?v=851U557j6HE&t=0s or the related problem. It seems it is not your case, but sometimes what looks like a computer error in approximating integrals is actually true! – Lorenzo Pompili Nov 22 '23 at 22:37
  • 1
    It is rather easy to believe that a computer algebra calculation of an integral whose true value is exactly $\pi/2$ would result in a numeric approximation with "only" 9 digits of accuracy. So, yes. Seriously. – Lee Mosher Nov 24 '23 at 02:33
  • 3
    You wrote "Desmos is not very reliable" but I think you meant "Desmos is extremely reliable and has an impressive precision of $10^{-8}$ on this integral" ;-) – Stef Nov 24 '23 at 09:31

6 Answers6

25

$$I=\int_0^{\pi/2}\int_0^{\pi/2}\frac{(\tan\alpha)(\tan\beta)}{\tan\alpha+\tan\beta} d\alpha d\beta\overset{\binom{\alpha=\arctan x}{\beta=\arctan y}}{=}\int_0^\infty\int_0^\infty\frac{xy}{(1+x^2)(1+y^2)(x+y)}dxdy$$ $$=\int_0^\infty\int_0^\infty\left(\frac1{1+x^2}-\frac1{1+y^2}\right)\frac{xy}{x+y}\frac{dxdy}{y^2-x^2}$$ $$=2\int_0^\infty\int_0^\infty\frac1{1+x^2}\frac{xy}{x+y}\frac{dxdy}{y^2-x^2}\overset{x=ty}{=}2\int_0^\infty dy\int_0^\infty\frac{t\,dt}{(1+t^2y^2)(1-t)(1+t)^2}$$ $$=2\int_0^\infty\frac{t\,dt}{(1-t)(1+t)^2}\int_0^\infty\frac{dy}{1+t^2y^2}$$ $$=\pi\int_0^\infty\frac{dt}{(1-t)(1+t)^2}\overset{x=\frac1t}{=}-\pi\int_0^\infty\frac{x\,dx}{(1-x)(1+x)^2}$$ $$\Rightarrow\,\,2I=\pi\int_0^\infty\frac{dx}{(1+x)^2}\,\,\Rightarrow\,\,I=\frac\pi2$$

Svyatoslav
  • 15,657
  • 1
    Can you comment on the singularity at $t=1$? I see you have sort of canceled it out in the penultimate step but how can you justify carrying it around? – Ron Gordon Nov 22 '23 at 13:34
  • 2
    @Ron Gordon, thank you for your question. Regarding the singularity: we are allowed to write the integral as $$\int_0^\infty\int_0^\infty\left(\frac1{1+x^2}-\frac1{1+y^2}\right)\frac{xy}{x+y}\frac{dxdy}{y^2-x^2}$$ $$=\int_0^\infty\int_0^\infty\frac1{1+x^2}\frac{xy}{x+y}\frac{dxdy}{y^2-x^2}-\int_0^\infty\int_0^\infty\frac1{1+y^2}\frac{xy}{x+y}\frac{dxdy}{y^2-x^2}$$ where every integral exists separately and is evaluated in the principal value sense. The last integral can be evaluated directly (also in the principal value sense) and gives $$\int_0^\infty\frac{dt}{(1-t)(1+t)^2}=\frac12$$ – Svyatoslav Nov 22 '23 at 15:08
17

A variant of Svyatoslav's solution, using polar coordinates $(x, y) = (r \cos \phi, r \sin\phi)$:

$$ \begin{align} I &=\int_0^{\pi/2}\int_0^{\pi/2}\frac{\tan\alpha \tan\beta}{\tan\alpha+\tan\beta} d\alpha d\beta \\ &=\int_0^\infty\int_0^\infty\frac{xy}{(x+y)(1+x^2)(1+y^2)}dxdy \\ &= \int_0^{\pi/2} \frac{\cos\phi \sin\phi}{\cos \phi + \sin\phi}\left( \int_0^\infty \frac{r^2}{(1+r^2 \cos^2\phi)(1+r^2\sin^2\phi)} \, dr \right) d\phi \, . \end{align} $$ For $ 0 < \phi < \pi/2$ the inner integral is $$ \begin{align} &\frac{1}{ \sin^2 \phi-\cos^2\phi } \int_0^\infty \left( \frac{1}{1+r^2 \cos^2 \phi)} - \frac{1}{1+r^2 \sin^2\phi}\right) dr \\ &\qquad = \frac{1}{ \sin^2 \phi-\cos^2\phi } \left[ \frac{\arctan(r \cos\phi)}{\cos \phi} - \frac{\arctan(r \sin\phi)}{\sin\phi}\right]_{r=0}^{r=\infty} \\ &\qquad = \frac{1}{\cos \phi \sin\phi (\cos\phi + \sin\phi)} \frac{\pi}{2} \, . \end{align} $$ It follows that $$ I = \frac{\pi}{2} \int_0^{\pi/2} \frac{1}{(\cos\phi + \sin\phi)^2} d\phi = \frac{\pi}{2} \left[ \frac{\sin \phi}{\cos\phi+\sin\phi}\right]_{\phi=0}^{\phi=\pi/2}= \frac{\pi}{2} \, . $$

Martin R
  • 113,040
6

Long comment

Related result: The expected length of one of the sides of the triangle (not the base) is

$$\frac{4}{\pi^2}\int_0^{\pi/2}\int_0^{\pi/2}\frac{\sin \beta}{\sin (\alpha+\beta)}d\alpha d{\beta}$$

$$=\frac{4}{\pi^2}\int_0^{\pi/2}\left[(\sin \beta)\log\left(\tan\left({\frac{\alpha+\beta}{2}}\right)\right)\right]_0^{\pi/2}d\beta$$

$$=\frac{4}{\pi^2}\int_0^{\pi/2}(\sin \beta)\log\left(\frac{\tan\left({\frac{\frac{\pi}{2}+\beta}{2}}\right)}{\tan\left({\frac{\beta}{2}}\right)}\right)d\beta$$

$$=\frac{4}{\pi^2}\left[\beta-\log\left(\frac{\sin b}{2}\right)-(\cos\beta)\log \left(\frac{\cos\left(\frac{\beta}{2}\right)\left(\cot\left(\frac{\beta}{2}\right)+1\right)}{\cos\left(\frac{\beta}{2}\right)-\sin\left(\frac{\beta}{2}\right)}\right)\right]_0^{\pi/2}$$

$$=\frac{2\pi+\log 16}{\pi^2}$$

(with help from Wolfram)

Dan
  • 22,158
4

The first antiderivative is quite simple.

After solving the inner integral, we are left with:

$$\int \sin (b) \left(\frac{1}{2} \pi \cos (b)+\sin (b) \,\log (\tan (b))\right)\,db$$ Now, there is a quite nasty antiderivative.

Using the bounds, the first term is $\frac \pi 4$.

So, for the total, $$I=\frac \pi 4+ \frac{1}{16} (4+i \pi ) \pi-i\frac{ \pi ^2}{16}=\frac \pi 2$$

Edit

$$I=\int \frac{\tan (a) \tan (b)}{\tan (a)+\tan (b)}\, da$$ $$I=\sin (b) (a \cos (b)-\sin (b) \log (\sin (a+b)))$$ Using the bounds, the integral written at the top.

$$J=\int \sin ^2(b) \log (\tan (b))\,db$$ $$J=\frac{1}{2} i \text{Li}_2\left(e^{2 i b}\right)-\frac{1}{8} i \text{Li}_2\left(e^{4 i b}\right)+\frac{b}{2}+b \tanh ^{-1}\left(e^{2 i b}\right)+$$ $$\frac{1}{2} b \log (\tan (b))-\frac{1}{4} \sin (2 b) \log (\tan (b))$$

Now, use the bounds.

4

$$\frac{\tan(\alpha)\tan(\beta)}{\tan(\alpha)+ \tan(\beta)}= -\cot(\alpha+ \beta) +\frac{1}{\tan(\alpha)+ \tan(\beta)}$$

$$\displaystyle I:=\int _0^{\frac{\pi}2}\int _0^{\frac{\pi}2}\frac{\tan(\alpha)\tan(\beta)}{\tan(\alpha)+ \tan(\beta)} d \alpha d \beta=\int _0^{\frac{\pi}2}\int _0^{\frac{\pi}2}-\cot(\alpha+ \beta) +\frac{1}{\tan(\alpha)+ \tan(\beta)} d \alpha d \beta$$

$\\[4pt]$

for $\displaystyle \int \frac{1}{\tan x+ c}dx$ let $\tan x = t $ then $$\int \frac{1}{\tan x+ c}dx= \int \frac{1}{(t^2+1)(t+c)}dt$$ $$=\frac{c}{c^2+1}\int\frac{1}{1+t^2} dt -\frac{1}{2(c^2+1)}\int \frac{2t}{t^2+1}dt + \frac{1}{c^2+1}\int\frac{1}{c+t} dt $$ $$\frac{c}{c^2+1} \arctan(t) - \frac{1}{2(c^2+1)}\ln|t^2+1| +\frac{1}{c^2+1} \ln|t+c|$$ $$=\frac{c}{c^2+1} x +\frac{1}{(c^2+1)}\ln|\cos(x)| +\frac{1}{c^2+1} \ln|\tan(x)+c|$$ $\\[3pt]$ $$I=\int _0^{\frac{\pi}2} \biggr|-\ln|\sin(\alpha + \beta)| + \frac{\tan(\beta)}{\sec^2(\beta)} \alpha +\frac{1}{(\sec^2(\beta))}\ln|\cos(\alpha)| +\frac{1}{\sec^2(\beta)} \ln|\tan(\alpha)+\tan(\beta)|\biggr|_0 ^{\frac{\pi}{2}} d\beta$$ $$=\int _0^{\frac{\pi}2} \ln|\tan(x)| +\frac{\pi}{4}\sin(2\beta )+ \cos^2(\beta )(-\ln(\tan(\beta))) d\beta$$

first we can see that $\displaystyle \int _0 ^ \frac{\pi}{2}\ln(\tan(\alpha)) d\alpha= \int _{0}^ \frac{\pi}{2} \ln ( \cot \alpha)du =0 $ because $\displaystyle \int _0 ^ \frac{\pi}{2}\ln(\tan(\alpha)) d\alpha =-\int _0 ^ \frac{\pi}{2}\ln(\tan(\alpha)) d\alpha$ by king's rule

and $\displaystyle \int_0^{\frac{\pi}{2}} \sin(2\beta) d \beta =-\frac{\cos(2\beta)}{2} \biggr|_0^{\frac{\pi}{2}} = 1$ so that means $$I = \frac{\pi}{4} - \int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\tan(\beta)) d\beta$$

$$J:=\int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\tan(\beta)) d\beta=\int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\sin(\beta)) d\beta-\int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\cos(\beta)) d\beta $$

$$=\int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\sin(\beta)) d\beta+\int _0^{\frac{\pi}{2}}\ln(\cos(\beta)) (1-\cos^2(\beta)) d\beta -\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$

since $\displaystyle \int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\sin(\beta)) d\beta=\int _0^{\frac{\pi}{2}}\ln(\cos(\beta)) (\sin^2(\beta)) d\beta$ by king's rule so

$$J = 2\int _0^{\frac{\pi}{2}}\cos^2(\beta)\ln(\sin(\beta)) d\beta-\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$

let $\displaystyle y= \sin(\beta)$

$$=2\int _0^{1}\ln(y)\sqrt{1-y^2}dy -\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$ here I will use integration by parts and integrate $\sqrt{1-y^2} $ $$J=y \ln(y)\sqrt{1-y^2} +\arcsin(y)\ln(y)\biggr|_0^1 -\int_0^1 \sqrt{1-y^2} dy - \int_0^1 \frac{\arcsin{y}}{y} dy -\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$

since $\displaystyle \lim\limits_{y \to 0}y \ln (y) =0$(why ? use L'Hôpital's rule) and $\lim\limits_{y \to 0}\arcsin{y} \ln (y) =0$(why ? substitute $\sin(t) = x$ and use L'Hôpital's rule )

and since $\displaystyle \int _0 ^1 \sqrt{1-y^2} dy = \frac{\pi}{4}$

$$J= -\frac{\pi}{4 } + \int_0^1 \frac{\arcsin{y}}{y} dy -\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$ $$-\frac{\pi}{4 } -\int _0^{\frac{\pi}{2}} \beta \cot(\beta) d\beta -\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$ $$=-\frac{\pi}{4 } - \beta \ln(\sin ( \beta))\biggr|_{0}^{\frac{\pi}{2}} +\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta -\int _0^{\frac{\pi}{2}} \ln(\cos(\beta)) d\beta $$

$$= -\frac{\pi}{4 }$$

so $$\color{red}{I = \frac{\pi}{4} -J =\frac{\pi }{2}}$$

pie
  • 4,192
3

Expanding on an earlier comment: let $(u,v)=\left(\dfrac{1-\tan \alpha}{1+\tan \alpha}, \dfrac{1-\tan \beta}{1+\tan \beta}\right)$, i.e. $(\alpha,\beta) = \left(\dfrac\pi4-\arctan u,\dfrac\pi4-\arctan v\right)$, to rewrite the integral as

$$\begin{align*} I &= \int_0^{\tfrac\pi2} \int_0^{\tfrac\pi2} \frac{\tan \alpha \tan \beta}{\tan \alpha + \tan\beta} \, d\alpha\,d\beta \\ &= \frac12 \int_{-1}^1 \int_{-1}^1 \frac{\frac{1-u}{1+u} \cdot \frac{1-v}{1+v}}{\frac{1-u}{1+u} + \frac{1-v}{1+v}} \, \frac{du}{1+u^2} \, \frac{dv}{1+v^2} \\ &= \frac12 \underbrace{\int_{-1}^1 \int_{-1}^1 \frac{1-u}{1+u^2} \, \frac{1-v}{1+v^2} \, \frac{du\,dv}{1-uv}}_{=\pi} \end{align*}$$

The inner integral is elementary:

$$\begin{align*} & \int_{-1}^1 \frac{1-u}{1+u^2} \, \frac{du}{1-uv} \\ &= \frac{1+v}{1+v^2} \int_{-1}^1 \frac{du}{1+u^2} + \frac{1-v}{1+v^2} \int_{-1}^1 \frac{u}{1+u^2} \, du - \frac{v(1-v)}{1+v^2} \int_{-1}^1 \frac{du}{1-uv} \\ &= \frac\pi2 \frac{1+v}{1+v^2} - 2 \frac{1-v}{1+v^2} \operatorname{artanh}v \end{align*}$$

and we're left with

$$\begin{align*} & \frac\pi2 \int_{-1}^1 \frac{1-v^2}{\left(1+v^2\right)^2} \, dv - 2 \int_{-1}^1 \frac{(1-v)^2}{\left(1+v^2\right)^2} \operatorname{artanh} v \, dv \\ &= \frac\pi2 + \underbrace{\int_{-1}^1 \frac{(1-v)^2}{\left(1+v^2\right)^2} \log \frac{1-v}{1+v} \, dv}_{=:J} \end{align*}$$

Showing $J=\dfrac\pi2$ can be done by enforcing $v\mapsto\dfrac{1-v}{1+v}$, folding up the subsequent integral at $v=1$ and expanding into partial fractions, exploiting power series, and integrating by parts:

$$\begin{align*} J &= 2 \int_0^\infty \frac{\left(1-\frac{1-v}{1+v}\right)^2}{\left(1+\frac{(1-v)^2}{(1+v)^2}\right)^2} \log v \, \frac{dv}{(1+v)^2} \\ &= 2 \int_0^\infty \frac{v^2}{\left(1+v^2\right)^2} \log v \, dv \\ &= 2 \int_0^1 \left(\frac1{1+v^2} - \frac2{\left(1+v^2\right)^2}\right) \log v \, dv \\ &= 2 \sum_{n\ge0} (-1)^{n+1} (2n+1) \int_0^1 v^{2n} \log v \, dv \\ &= 2 \sum_{n\ge0} \frac{(-1)^n}{2n+1} = 2\arctan 1 = \frac\pi2 \end{align*}$$

user170231
  • 19,334