Two Rectangles


Find two rectangles, with integral sides, such that the area of the first is three times the area of the second, and the perimeter of the second is three times the perimeter of the first.

Source: The Penguin book of Curious and Interesting Puzzles, David Wells, 1992, #21.
[Taken from "Ken's Puzzle of the Day" September 21, 1994]


Update 15 October, 2003:  Cleverley Graham found a very nice general solution.

Expressing the equations as 3*a*b=x*y and 3*(x+y)=a+b, and using the convention that where m is a factor of n then m' is the corresponding factor such that m'=n/m.
 
Then for any integer a, for any factor f of a and for any factor g of 26, write
 
x = 9 * a + 3 * f * g
y = 9 * a + f' * g' * a
b = 53 *a + 9 * f * g + 3 * f' * g' * a
 
to get all possible integer solutions of the equations.
 
Proof
 
x * y = (9 * a + 3 * f * g) * (9 * a + f' * g' * a)
       = (81 * a^2 + 9 * f' * g' * a^2 + 27 * f * g * a + 3 * 26 * a^2)
       = 3 * a * (53 * a + 3 * f' * g' * a + 9 * f * g  )
       = 3 * a * b
 
 
a + b = 54 * a + 9 * f * g + 3 * f' * g' * a
        = 3 * (18 * a + 3 * f * g + f' * g' * a)
        = 3 * ((9 * a + 3 * f * g) + (9 * a + f' * g' * a))
        = 3 * (x + y)

If you're interested the generalised problem m*a*b=x*y and n*(x+y)=a+b is solved if you make g a factor of m*n^2 - 1 (instead of  26) and write:
 
x = m*n* a + n * f * g
y = m*n * a + f' * g' * a
b = a*(2*m*n^2 - 1) + m*n * f * g + n * f' * g' * a
 
It is provable in the same way.

Solution: I received several single solutions and asked for any generalizations that could be made. A few came back. I have made my own analysis and include it below and I welcome any comments. First are a few solvers' solutions:

From Ken Burres (khburres@detour.com):

1st Rectangle: 87 x 10
2nd Rectangle: 290 x 1

Let a,b be adjacent sides of the first rectangle
Let s,t be adjacent sides of the second rectangle

ab = 3st;      3 (2a + 2b) = 2s + 2t

t = ab / 3s  =>   6a + 6b = 2s + 2(ab/3s)

6a + 6b = 2s + (2ab / 3s);
18as + 18bs = 6s^2 + 2ab;
Let s = 1:   18a + 18b = 6 + 2ab;
18a - 6 = 2ab - 18b;
18a - 6 = b(2a - 18);
b = (18a - 6) / (2a - 18);
Let b = 10:  10 = (18a - 6) / (2a - 18);
20a - 180 = 18a - 6;
2a = 174;
a = 87

From Bill Chapp (chapp@rosemail.rose.hp.com):
#!/usr/bin/awk -f

# Given two rectangles, X and Y, with integral sides, such that Area(X)
#is three times Area(Y), and Perim(Y) is three times Perim(X).
#
# Let X have sides of length a and b, and Y have sides of length c and d.
#
# Therefore, a*b = 3*c*d
#       and, 2(c+d) = 3*2(a+b)  --> c+d = 3(a+b)
#
# For rectangle X, we know that a*b must be divisible by 3 in order to keep
# c and d integers.
#     Eqn1: (a*b)%3 == 0
# For given values of a and b, we can calculate c*d and c+d and determine
# if there are integers c and d which will work.
#
# We also know that for a given rectangle Y with known area, but unknown
# sides, we can express limits on the perimiter:
#   When one side is of length 1, we get the maximum perimeter:
#     Perim(Y)/2 <= Area(y)+1
#     Eqn2:  c+d <= c*d+1
#     Eqn2a: 3(a+b) <= a*b/3+1
#   When both sides are equal, we get the minimum perimeter:
#     Perim(Y)/2 >= 2*sqrt(Area(y))
#     Eqn3:  c+d >= 2*sqrt(c*d)
#     Eqn3a: 3(a+b) >= 2*sqrt(a*b/3)

BEGIN {
  printf("  a   b    a*b a+b   c*d c+d\n");
  printf("-----------------------------\n");
  for(a=1;a<=10;a++)
    for(b=1;b<=100;b++) {
      if((a*b)%3==0 && 3*(a+b) <= a*b/3+1 && 3*(a+b) >= 2*sqrt(a*b/3))
        printf("%3d %3d  %5d %3d %5d %3d\n",
               a,b,a*b,a+b,a*b/3,3*(a+b));
    }
}

# The output of this script yields:
#  a   b    a*b a+b   c*d c+d
#-----------------------------
# 10  87    870  97   290 291
# 10  90    900 100   300 300
# 10  93    930 103   310 309
# 10  96    960 106   320 318
# 10  99    990 109   330 327
#
# The first point meets the criteria for maximum perimeter, giving
# Rectangle X with sides of 10 and 87, area of 870 and perimeter of 194
# Rectangle Y with sides of 1 and 290, area of 290 and perimeter of 582
#
# To check the results: 290*3 = 870 and 194*3=582.

From Wilfred Theunissen and Evert Offereins (theuniw@unix2ccm.apd.dec.com, offeree@unix2ccm.apd.dec.com):
A computer program led to the following:

First rectangle a by b; Second rectangle c by d;
The area of the first rectangle is three times the second;
The perimeter of the second rectangle is three times the first;
This our the solutions for 1<=c<=1000:

a= 15 b= 22 c=110 d=  1
a= 12 b= 35 c=140 d=  1
a= 48 b= 11 c=176 d=  1
a= 42 b= 31 c=217 d=  2
a= 30 b= 44 c=220 d=  2
a= 57 b= 26 c=247 d=  2
a= 24 b= 70 c=280 d=  2
a= 87 b= 10 c=290 d=  1
a= 54 b= 53 c=318 d=  3
a= 45 b= 66 c=330 d=  3
a= 66 b= 45 c=330 d=  3
a= 96 b= 22 c=352 d=  2
a= 81 b= 40 c=360 d=  3
a= 36 b=105 c=420 d=  3
a=105 b= 36 c=420 d=  3
a= 75 b= 68 c=425 d=  4
a= 21 b=122 c=427 d=  2
a= 84 b= 62 c=434 d=  4
a= 60 b= 88 c=440 d=  4
a=114 b= 52 c=494 d=  4
a= 33 b=144 c=528 d=  3
a=144 b= 33 c=528 d=  3
a= 84 b= 95 c=532 d=  5
a=132 b= 49 c=539 d=  4
a= 75 b=110 c=550 d=  5
a= 48 b=140 c=560 d=  4
a=120 b= 71 c=568 d=  5
a=123 b= 70 c=574 d=  5
a=174 b= 20 c=580 d=  2
a=108 b=106 c=636 d=  6
a= 93 b=126 c=651 d=  6
a=126 b= 93 c=651 d=  6
a= 90 b=132 c=660 d=  6
a=132 b= 90 c=660 d=  6
a= 60 b=175 c=700 d=  5
a=192 b= 44 c=704 d=  4
a= 81 b=158 c=711 d=  6
a=162 b= 80 c=720 d=  6
a= 78 b=171 c=741 d=  6
a=171 b= 78 c=741 d=  6
a=141 b=112 c=752 d=  7
a=195 b= 58 c=754 d=  5
a=105 b=154 c=770 d=  7
a=102 b=161 c=782 d=  7
a= 72 b=210 c=840 d=  6
a=210 b= 72 c=840 d=  6
a=150 b=136 c=850 d=  8
a= 42 b=244 c=854 d=  4
a=168 b=124 c=868 d=  8
a= 30 b=261 c=870 d=  3
a=261 b= 30 c=870 d=  3
a=240 b= 55 c=880 d=  5
a=120 b=176 c=880 d=  8
a=210 b= 89 c=890 d=  7
a=111 b=200 c=925 d=  8
a=159 b=162 c=954 d=  9
a=162 b=159 c=954 d=  9
a= 84 b=245 c=980 d=  7
a=228 b=104 c=988 d=  8
a=135 b=198 c=990 d=  9
a=198 b=135 c=990 d=  9


Ken Duisenberg's Solution:
There are many solutions. For this analysis, we will first solve the general case. The equations are:
(1) (x+y) = m(a+b)
(2) ab = m(xy) --> y = ab/mx
(3a:2->1) (ab/mx) + x = m(a+b)
(3b) x^2 - m(a+b)x + ab/m = 0

The quadtratic formula for x yields:
(4) x = (1/2)[m(a+b) +/- sqrt( (m^2)(a+b)^2 - 4ab/m )]
For x to be an integer, the result of the square root must be an integer, so the term inside the radical must be a perfect square, so '4ab/m' is the difference between two squares.

Sideline (on the difference k between two squares):
t^2 - k = u^2.
(t-1)^2 = t^2 - (t + t-1)
(t-2)^2 = t^2 - (t + t-1) - (t-1 + t-2)
u^2 = t^2 - (t + t-1) - (t-1 + t-2) - ... - (t-(n-1) + t-n), for some n.
So, k = 2nt - n^2, and t = (k + n^2)/2n.

Here, we have t=m(a+b) and k=4ab/m, so:
m(a+b) = (4ab/m + n^2)/2n, for some integer n.
Solving for a, we find:
            mn(2mb-n)
        a = ----------
             4b-2nm^2
Note that n must be even because (i) if m is odd, then k=4ab/m=2nt-n^2 is even, so 2nt-n^2 is even, so n must be even; and (ii) if m is even, then if n is odd, a is not an integer, so n must be even. Since n is even, substitute 2n for n in the above equation:
            2mn(2mb-2n)      4mn(mb-n)     mn(mb-n)
        a = -----------  =  ----------- = ----------
             4b-4nm^2        4(b-nm^2)      b-nm^2
Equation (4) solves for x or y. Let:
(5) x = (1/2)[m(a+b) - sqrt( (m^2)(a+b)^2 - 4ab/m )]
and solve for a:
            mx(mb-x)
        a = ----------
             b-xm^2
to find that x=n.

So, the method of solution is:
A) Pick a positive integer x.
B) Pick positive integer b to make the above equation result in positive integer a.
C) y = ab/mx.

Some example answers for m=3,
(A) Choose x (B) Find b, a (C) y=ab/mx
1 10, 87 290
1 11, 48 177
1 12, 35 140
1 15, 22 110
2 19, 330 1045
2 31, 42 217
3 40, 81 360
3 53, 54 318

Mail to Ken