Average Area of a Triangle Created from 3 points on f ( x ) = sin ( x ) f(x)= \sin(x)

Calculus Level 3

x 1 x_{1} , x 2 x_{2} , and x 3 x_{3} are chosen randomly and independently on the interval [ 0 , 2 π ] [0,2\pi] and let f ( x ) = sin ( x ) f(x)=\sin(x) .

What is the average area of the triangle created with the three vertices below (to two significant figures)?

P 1 = ( x 1 , f ( x 1 ) ) , P 2 = ( x 2 , f ( x 2 ) ) , P 3 = ( x 3 , f ( x 3 ) ) P_{1}=\big( x_{1} , f( x_{1})\big),\quad P_{2}=\big( x_{2} , f( x_{2})\big),\quad P_{3}=( x_{3} , f( x_{3})\big)


The answer is 0.67.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Chris Lewis
Dec 3, 2018

By the shoelace theorem , the area of the triangle is given by

Δ = ( x 1 sin x 2 + x 2 sin x 3 + x 3 sin x 1 ) ( x 2 sin x 1 + x 3 sin x 2 + x 1 sin x 3 ) 2 \begin{aligned} \Delta=\frac{\left| (x_1 \sin{x_2}+x_2 \sin{x_3}+x_3 \sin{x_1})-(x_2 \sin{x_1}+x_3 \sin{x_2}+x_1 \sin{x_3}) \right|}{2} \end{aligned}

The average area can be evaluated numerically either by scanning over the parameter space (ie letting x 1 , x 2 , x 3 x_1,x_2,x_3 each step from 0 0 to 2 π 2\pi in small intervals, calculating the area for each of these, then averaging) or with a Monte-Carlo implementation (ie picking a large number of values for x 1 , x 2 , x 3 x_1,x_2,x_3 uniformly at random and again averaging).

The result comes out at 0.67 \boxed{0.67} , and seems to be a little higher than 2 3 \frac{2}{3} . Did anyone manage to find an exact value without resorting to numerical methods?

Did the Monte-Carlo way an got 0.668537 with 10,000,000,000 samples.

Tom Stein - 2 years, 6 months ago

Log in to reply

Agreed - My Monte Carlo ( GCC (and libraries) - double floating points - 7.3.0 x86 architecture) gives 0.66853x on about 10^9 samples. Rounding errors would probably go the other way, not adding very small areas to a very large total accumulator.

Ed Sirett - 2 years, 6 months ago

numerical integration using mpmath library gives the result of 0.668481 with an error of 1e-7

Ilya Lyubarsky - 2 years, 4 months ago
Vinod Kumar
Dec 5, 2018

Wrote a Python program generating pair of three random vertices (x, sin(x)) and calculated the average of area of 10000 random triangles using:

Area=abs[0.5{x1 (y2-y3)+x2 (y3-y1)+x3*(y1-y2)}]

Answer=0.668

Python3 Program on Ubuntu 18.04

import math

import random

n = int(input("Maximal Number? "))

TArea=0

counter = 0

while counter <= n-1:

x1=(2*math.pi)*random.random()

y1=math.sin(x1)

x2=(2*math.pi)*random.random()

y2=math.sin(x2)

x3=(2*math.pi)*random.random()

y3=math.sin(x3)

Area=abs(0.5*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)))

TArea +=Area

counter += 1

print("Answer",TArea/counter)

Same here, and got the value 0.669. My code is almost identical to yours!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
import math
import random

# Expected area of a random triangle determined by three points on a sine curve in [0,2 pi]

n=10**6         # Number of triplets simulated
i=1             # Counter
Area=0          # Area of the simulated triangle
Sum=0           # Cumulative area
EV=0            # Expected value of the area 

while i <= n:
    Ax=2*math.pi*random.random()                # x coordinate of the first random point on the sine curve (A).
    Ay=math.sin(Ax)                             # x coordinate of the first random point on the sine curve (A).
    Bx=2*math.pi*random.random()                # idem for points B and C.
    By=math.sin(Bx)
    Cx=2*math.pi*random.random()
    Cy=math.sin(Cx)

    Area=0.5*abs((Cx-Ax)*(By-Ay)-(Bx-Ax)*(Cy-Ay))    # The area this random triangle is
                                                     # one half of the abs. value of the cross product of vectors AB and AC.
    Sum+=Area                                        # We add all areas...
    i+=1

EV=Sum/n        # ... and calculate the average.

print ('The mean value of the areas simulated is', EV)

Gabriel Chacón - 2 years, 5 months ago

The program below is equivalent to calculating 800^3=512 million triangles, evenly distributed over the range. It is somewhat optimised for speed. I trust the answer upto 5 decimal places: 0.66852....

Some playing with parameter count and considering differences of the calculated values made me realize there a some small, but systematic underestimation due to discrete values being the same more likely than in a true random case. The error in these calculations is an underestimate that diminishes by a factor 4 when count doubles:

count result delta
25 0.661540
0.0053
50 0.666807
0.0013
100 0.668096
0.00032
200 0.668419
0.000081
400 0.668500
0.000020
800 0.6685203

Considering this, the true value must be close to 0.668527 \boxed{0.668527} .

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import math;

def MeanTriangleArea(count):
    ThirdArea=0; MaxValue=2.0*math.pi
    x=[];y=[];
    for t in range(0,count):
        xvalue=(t+.5)*MaxValue/count
        yvalue=math.sin(xvalue)
        x.append(xvalue)
        y.append(yvalue)
    for t1 in range(0,count):
        for t2 in range (t1,count):
            x2=x[t2]-x[t1]; y2=y[t2]-y[t1]
            for t3 in range (t2,count):
                x3=x[t3]-x[t1]; y3=y[t3]-y[t1]
                ThirdArea += abs((x2)*(y3)-(y2)*(x3))

    # The area of each triangle is |a×b|/2, so only half the calculated value
    # We only considered t1<t2<t3, but there are 3!=6 permutations of (t1,t2,t3)
    # Combined we need to multiply with 3
    return 3.0*ThirdArea/(count*count*count)

print(MeanTriangleArea(800));

K T - 9 months, 3 weeks ago
Kevin Tong
Dec 4, 2018

Using the Shoelace Theorem, we have the area is 1 2 x 1 sin x 2 + x 2 sin x 3 + x 3 sin x 1 x 2 sin x 1 x 3 sin x 2 x 1 sin x 2 \frac{1}{2}\left| x_1\sin x_2+x_2\sin x_3+x_3\sin x_1 - x_2\sin x_1 - x_3\sin x_2 - x_1\sin x_2\right| We then use a program to find the average area to get a value of approximately 0.67 \boxed{0.67} .

Max Brodsky
Dec 5, 2018

One can find the exact average by executing a triple integral with integrand as the shoelace area mentioned in other answers and parameters of each x value going from 0 to 2pi and dividing by the input volume. This gives exactly two-thirds.

That integral is unsolvable and computing that integral numerically gives about 0.66 or 0.67 .

Hari Krishna - 2 years, 6 months ago

Unless you show how, this answer must be considered as bluff. And the answer is not exactly 2/3.

K T - 9 months, 3 weeks ago

area = Function[{a, b, c}, Block[{p1 = {a, Sin[a]}, p2 = {b, Sin[b]}, p3 = {c, Sin[c]}}, Area[ SSSTriangle[ EuclideanDistance[p1, p2], EuclideanDistance[p2, p3], EuclideanDistance[p3, p1]] ] ] ];

z = Table[area @@ t, {t, RandomReal[{0, 2 [Pi]}, {1000000, 3}]}]

z1 = Select[z, # [Element] Reals &]

(* One generated triangle was so degenerate that it failed sum of side test for a triangle. I substituted 0 as its area. *)

Length[z1] is 999 999

Mean[Join[z1, {0.}]] is 0.669701546195

(* Mathematica 11.3 used *)

what are you sying

Nahom Assefa - 2 years, 6 months ago

Log in to reply

I have been a programmer for more than a half century. I gave the source code for the Monte Carlo simulation I used. Line for line not including comments in (* *): 1. Define a function that computes the area of a triangle whose three sides are specified by three points whose x-coordinates are arguments and their y-coordinates by Sin[x-coordinate].

  1. Compute a one million entry table of areas of such triangles.

  2. Select those areas which give real results. There was one triangle that was degenerate.

  3. Add in a zero area for the degenerate triangle and compute the mena of the table.

Q.E.D.

A Former Brilliant Member - 2 years, 6 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...