Enigmatic Code

Programming Enigma Puzzles

Enigma 320: Triangular farm

From New Scientist #1468, 8th August 1985 [link]

Enigma 320

Edgar’s farm is in the shape of an equilateral triangle (ABC in the diagram). It is divided into seven fields by three straight hedges, AQ, BR and CP. The fields such as BQT are 8 acres, and those such as ASUR are 22 acres. All I want to know is: what is the exact acreage of the middle field, STU?

[enigma320]

Advertisements

2 responses to “Enigma 320: Triangular farm

  1. Jim Randell 20 November 2015 at 7:49 am

    We have already solved a similar problem to this in Enigma 1313 (although it was set 19 years after this problem).

    The ratio of the area of the triangles BQT and ABT is:

    area(BQT) / area(ABT) = k² / (1 − k)

    in our case:

    k² / (1 − k) = 8 / (8 + 22) = 4 / 15
    15k² + 4k − 4 = 0
    (3k + 2)(5k − 2) = 0

    We’re interested in the root where 0 < k < ½.

    So:

    k = 2/5

    Which we can plug back into the equation we derived in Enigma 1313 for the ratio of the area of the central triangle to the overall triangle (or we can note that the problem text for Enigma 1313 tells us that in the case of k=2/5 the ratio is R=1/19).

    So if the area of the central triangle is X:

    19X = X + 90
    X = 5

    Solution: The area of the field STU is 5 acres.

    Here’s a Python program that uses SymPy to do the maths from scratch:

    from sympy import symbols, simplify, solve, sin, pi, Eq
    from enigma import printf
    
    def degrees(d):
      return pi * d / 180
    
    sin60 = sin(degrees(60))
    
    # if we start with an equilateral triangle with side AB = BC = CA = 1
    #
    # the area of the triangle is:
    #
    # area(ABC) = 1/2 AB BC sin(60 degrees)
    
    ABC = sin60 / 2
    printf("area(ABC) = {ABC}")
    
    # now suppose AP = BQ = CR = k
    k = symbols('k')
    
    # then:
    #
    # area(ABQ) = area(BCR) = area(CAP) = 1/2 AB BQ sin(60 degrees)
    
    ABQ = k * sin60 / 2
    printf("area(ABQ) = {ABQ}")
    
    # to determine area(APS) = area(BQT) = area(CRU) we place a point D
    # on BC such that RD is parallel to AQ
    #
    # then RCD is a similar triangle to ACQ, particularly
    #
    # CD / CQ = CR / CA
    #
    
    CD = (1 - k) * k
    
    # the area of RCD is then:
    #
    # area(RCD) = 1/2 CR CD sin(60 degrees)
    
    RCD = k * CD * sin60 / 2
    printf("area(RCD) = {RCD}")
    
    # and the area of BDR is:
    #
    # area(BDR) = area(BCR) - area(RCD)
    
    BDR = simplify(ABQ - RCD)
    printf("area(BDR) = {BDR}")
    
    # the area of BQT is the area of the similar triangle BDR multiplied by r^2
    # where is the ratio of the sides
    #
    # r = BQ / BD
    
    r = simplify(k / (1 - CD))
    printf("r = {r}")
    
    BQT = (r ** 2) * BDR
    printf("area(BQT) = {BQT}")
    
    # the area of the quadrilateral BTSP is:
    #
    # area(BTSP) = area(ABQ) - area(APS) - area(BQT)
    
    BTSP = simplify(ABQ - 2 * BQT)
    printf("area(BTSP) = {BTSP}")
    
    # and the area of the central triangle STU is:
    #
    # area(STU) = area(ABC) - 3(area(APS) + area(BTSP))
    
    STU = simplify(ABC - 3 * (BQT + BTSP))
    printf("area(STU) = {STU}")
    
    # so we can compute the relative areas of the corner fields, the edge
    # fields and the central field
    
    corner = simplify(BQT / ABC)
    edge = simplify(BTSP / ABC)
    middle = simplify(STU / ABC)
    printf("corner = {corner}, edge = {edge}, middle = {middle}")
    
    
    # now to solve the puzzle...
    
    # the ratio of the corner fields to the edge fields is 8 / 22
    # solve this equation to give a value for k
    for v in solve(Eq(22 * corner, 8 * edge), k):
    
      # we want 0 < k < 1/2
      if not(0 < 2 * v < 1): continue
      printf("k = {v}")
    
      # produce actual values for the corner, edge and middle fields
      (c, e, m) = (x.subs(k, v) for x in (corner, edge, middle))
    
      # scale up the triangle to give the fields the required areas
      t = 8 / c
      (c, e, m) = (t * x for x in (c, e, m))
      printf("t = {t}")
      
      printf("corner = {c}, edge = {e}, middle = {m}")
    

    The total area of the farm is 95 acres, which is 19/128 of a square mile. So the farm is approximately 0.5855 miles along each edge, which is about 3091.4 ft (≈ 942.26 m).

    Should it ever be needed in future the program makes the following determinations:

    Each of the 3 corner fields (like BQT) accounts for k³ / (1 − k + k²) of the total area of the triangle (in this case 8 / 95).

    Each of the 3 edge fields (like ASUR) accounts for (k − k² − k³) / (1 − k + k²) of the total area of the triangle (in this case 22 / 95).

    The central field (STU) accounts for (1 − 4k + 4k²) / (1 − k + k²) of the total area of the triangle (in this case 5 / 95 = 1 / 19).

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: