The Museum of HP Calculators

HP Forum Archive 08

 Short & Sweet Math Challenges for HP fans #1Message #1 Posted by Ex-PPC member on 27 May 2002, 9:59 a.m. Hi HP lovers: Here is a new, tentative 'column' for those HP fans mathematically inclined like myself. If you like math, specially the recreational, funny variety, you're bound to like this 'column'. If the number of (hopefully positive) responses warrants it, I will post a new math 'challenge' every Monday or so. If not, well, at least I tried ... This week, a sweet trig challenge in 6 short steps: 1) Take your favourite HP handheld (any will do as long as it can do trigs) 2) Set it to [Degrees] trig mode 3) First, compute: tan(59) + tan(60) + tan(61) 4) Then, compute : tan(59) * tan(60) * tan(61) 5) Explain the result 6) Enlightened by your clever explanation, write a very short program for your HP handheld which will output many other sets of 3 numbers with the same property. That's all, folks. Best regards.

 Re: Short & Sweet Math Challenges for HP fans #1Message #2 Posted by Pascal on 27 May 2002, 6:12 p.m.,in response to message #1 by Ex-PPC member Interesting feature :-) Obviously there's a symmetry: tan(x-e)+tan(x)+tan(x+e) = tan(x-e)+tan(x)+tan(x+e) So, if e goes to 0, you get 3*tan(x) = tan(x)^3 <=> tan(x)^2 = sqrt(3) <=> x = atan(sqrt(3)) <=> x = 60 degrees So for x=60, e can be basically anything as long as you stay within the defined range for tan. Incidentally, this works also for x=-60 deg, x=120 deg, and so on... Why? Well, I don't know. The "center" points have in common that their 1st derivative is 4 [given by 1/cos^2]. Once these properties are known, writing a program to produce those triplets is easy enough. But that's only my 5 cents, and I'm already looking forward to a better explanation... Pascal

 Just off the top of my head...Message #3 Posted by Steve (Australia) on 27 May 2002, 10:20 p.m.,in response to message #1 by Ex-PPC member excuse any errors, I haven't got a calculator here :-) tan(a +/- b) = (tan a +/- tan b)/(1 -/+ tan a tan b) tan(60 +/- x) - (sqrt 3 +/- tan x)/(1 -/+ sqrt 3 tan x) tan(60 - x) + tan 60 + tan (60 + x) = (sqrt 3 - tan x)/(1 + sqrt3 tanx) + sqrt3 + (sqrt 3 + tanx)/(1 - sqrt3 tanx) = sqrt 3 + ((sqrt 3 - tanx)(1 - sqrt3 tanx) + (sqrt 3 + tanx)(1 + sqrt3 tanx))/(1 + sqrt3 tanx)(1 - sqrt 3 tanx) = sqrt 3 + (sqrt3 - tanx - 3tanx + sqrt3tan^2x + sqrt3 + tanx + 3tanx + sqrt3tan^2x)/(1 - 3tan^2x) = sqrt3 + (2sqrt3 + 2sqrt3tan^2x)/(1 - 3tan^2x) = [sqrt3(1 - 3tan^2x) + 2sqrt3 + 2sqrt3tan^2x]/(1 - 3tan^2x) = [sqrt3 - 3sqrt3tan^2x + 2sqrt3 + 2sqrt3tan^2x]/(1 - 3tan^2x) = [3sqrt3 - sqrt3tan^2x]/(1 - 3tan^2x) = sqrt3(3 - tan^2x)/(1 - 3tan^2x) tan(60-x)Tan(60)tan(60+x) = (sqrt 3 - tan x)/(1 + sqrt3 tanx) . sqrt3 . (sqrt 3 + tanx)/(1 - sqrt3 tanx) = [sqrt3 . (sqrt3 + tanx) . (sqrt3 - tanx)] / [(1 + sqrt3 tanx) . (1 - sqrt3 tanx) ] = sqrt3(3 - tan^2x)/(1 - 3tan^2x) so they're equal! so subject to the usual restrictions the +/- 1 used in the example can be any real number.

 Is the HP48/49 up to the task ?Message #4 Posted by Ex-PPC member on 28 May 2002, 7:15 p.m.,in response to message #3 by Steve (Australia) Congratulations to those keen people that saw that the required condition is: a + b + c = 180 (degrees, or 2Pi radians) Now the question is: can the advanced symbolic math capabilities of the HP48/49 models help with the demonstration ? Basically, you need to transform, rearrange, and generally symbolically manipulate this identity to get one side given the other (or to reduce both sides to a common intermediate expression): tan(a)+tan(b)+tan(180-a-b) = tan(a)*tan(b)*tan(180-a-b) (or 2Pi instead of 180, if using radians). This is a much harder nut than the usual run-of-the-mill trigonometric identities frequently seen as didactic examples. Can your symbolic-math-capable HP handheld help with it ?

 Re: Is the HP48/49 up to the task ?Message #5 Posted by Mike Markowski on 7 June 2002, 10:56 a.m.,in response to message #4 by Ex-PPC member The hp 49g can do almost all of it. First, you the wielder of the blue box must realize that a+b+c=180 degrees. (I wish I could format this post.) Next, in the equation writer I entered: TAN(X) + TAN(Y) + TAN(pi - (X+Y)) and then hit TEXPAND from the TRIG menu. Then I hit FACTOR from the ALG menu. At that point the display read TAN(X) TAN(Y) (TAN(X) + TAN(Y)) / (TAN(X) TAN(Y) - 1) and it was up to me to realize that the final factor was really TAN(pi - (X+Y)). So the brain was needed for a little bit of it. :-) -- Mike

 Re: Just off the top of my head...Message #6 Posted by John Ioannidis on 29 May 2002, 8:35 a.m.,in response to message #3 by Steve (Australia) It's much easier than that: the property holds for any three angles A, B, C such that A+B+C = 2*pi. Then: tanA+tanB+tanC = tanA + tanB + tan(2*pi - A - B) = tanA + tanB-tan(A+B) tanA + tanB = tanA + tanB - ------------- (1-tanA*tanB) (tanA + tanB)*(-tanA*tanB) = ---------------------------- (1-tanA*tanB) tanA + tanB = tanA * tanB * (- ------------- ) (1-tanA*tanB) = tanA * tanB * (- tan(A+B)) = tanA * tanB * tan(2*pi - A - B) = tanA * tanB * tanC QED

 Re: Just off the top of my head...Message #7 Posted by John Ioannidis on 29 May 2002, 4:07 p.m.,in response to message #6 by John Ioannidis Bloody 'ell! I forgot that things get reformatted here. OH well, someone else has effectively the same proof in this thread. One of my favorite trigonometric (well, geometric really) properties is that the area of a triange is sqrt(t*(t-a)*(t-b)*(t-c)), where a, b, and c are the lengths of the sides, and t=(a+b+c)/2

 Thanks to both and yes, but ...Message #8 Posted by Ex-PPC member on 28 May 2002, 9:24 a.m.,in response to message #1 by Ex-PPC member ... just a little hint: The triplet (37, 73, 70) is also a solution: tan(37) + tan(73) + tan(70) = tan(37) * tan(73) * tan(70) as you can easily verify with your favorite HP calc, yet, it isn't of the form (60-x, 60, 60+x) as you can easily observe ... Perhaps it will be enlightening (if slow) to give a chance to empirical methods. After all, most HP calcs do not do symbolic math. You could for instance run a version for your HP of this pseudo-code: set degrees trig mode for a = 0 to 360 for b = 0 to 360 for c = 0 to 360 if tan(a)+tan(b)+tan(c)=tan(a)*tan(b)*tan(c) then print "Solution:",a,b,c next c next b next a and see if you can deduct anything from the solution triplets printed. Once enlightened, you can use your wonderful 48/49 to do the symbolic math needed to prove your clever conjecture. [of course, the above program would need to be optimized to run in acceptable times, and to cater for rounding errors in the computation before testing for equality, not to mention range errors]

 Re: Thanks to both and yes, but ...Message #9 Posted by thibaut.be on 28 May 2002, 10:00 a.m.,in response to message #8 by Ex-PPC member It seems than when the sum of a+b+c = 180° (or pi), the product and the sums of the tans are equal... I'm currently running this routine (not on a HP calc, because 360^3 loops 46.656.000 loops are too much, and I'll see if I can deduct something... But why, I don't know. I've had a look at my trigonometric formulaes, but I haven't found yet something that rang me a bell...

 Re: Thanks to both and yes, but ...Message #10 Posted by Dave Shaffer on 28 May 2002, 12:08 p.m.,in response to message #9 by thibaut.be Thibaut seems to be on the right track. A simple BASIC program indicates that when the sum of the angles equals 180 degrees, the product of the tangents equals the sum of the tangents. I haven't done the expansions yet, but I suspect the method used by Steve, applied (recursuvely) to tan(a + (b+c)), with the condition that a+b+c = 180, will prove fruitful. By the way, when writing your programs (HP or otherwise) to check sum(tangents) = prod(tangents), don't forget that the proper check is to determine whether the (absolute value of the) DIFFERENCE is within some tolerance (that depends on the number of significant figures in your computer). 1e-5 or 1e-6 (to use old-fashioned (?) FORTRAN notation) is probably good enough. This is something you learn on day 2 or 3 of a programming techniques course.

 Re: Thanks to both and yes, but ...Message #11 Posted by thibaut.be on 28 May 2002, 2:18 p.m.,in response to message #10 by Dave Shaffer I forgot to mention than none of a,b, or c must be = 0 of course. But I'm still expecting the maths demonstration

 Re: Thanks to both and yes, but ...Message #12 Posted by Steve (Australia) on 28 May 2002, 7:44 p.m.,in response to message #10 by Dave Shaffer Ah! If the rule is that the sum of the angles must be 180 then I suspect you should be looking at some if the identities involving triangles :-) (I'm rather too busy at the moment)

 Re: Thanks to both and yes, but ...Message #13 Posted by Steve (Australia) on 28 May 2002, 8:01 p.m.,in response to message #8 by Ex-PPC member since both addition and multiplication are commutative, and because the solution a, b, c is the same as c, a, b and c, b, a, ... you can halve your execution times as follows: for a = 0 to 360 for b = a to 360 <---------- this for c = b to 360 <---------- and this if tan(a)+tan(b)+tan(c)=tan(a)*tan(b)*tan(c) then print "Solution:",a,b,c next c next b next a and because all possible values of tan can be found in the interval -90 to 90, we can reduce the number of iterations (as well as the nasty discontinuities) by for a = -89 to 89 for b = a to 89 for c = b to 89 if tan(a)+tan(b)+tan(c)=tan(a)*tan(b)*tan(c) then print "Solution:",a,b,c next c next b next a if we're only interested in the domain 0 to 360, then we need to report +ve a, b, c as a or 180 - a and negative a, b, c as 360 + a or 180 + a then find a general solution by inspection :-) then you need to convince yourself that there are *not* solutions at the discontinuities ;-)

 Obvious correctionMessage #14 Posted by Steve (Australia) on 28 May 2002, 8:26 p.m.,in response to message #13 by Steve (Australia) when I said > a or 180 - a > and negative a, b, c as > 360 + a or 180 + a I obviously didn't mean that :-) a or 180 + a and negative a, b, c as 360 + a or 180 + a and I have found empirically that a + b + c must be a multiple of 180 I would tend to suspect that 90, 1, 89 would be a solution, but would anyone care to comment? By the same token, 90, 90, 90 would not be a solution. Hmmmm..... oh, and I'd write a pseudo code solution for anyone wanting to investigate this in this manner: ``` i, j, k : integer a, b, c : double epsilon = 1e-9 begin for i := -89 to 89 do a := tan(i*pi/180) for j := i to 89 do b := tan(j*pi/180) for k := j to 89 do c := tan(k*pi/180) if abs((a+b+c) - (a*b*c)) < epsilon then solution is i, j, k (sum is i+j+k) endif next next next end; ```

 And the answer is ...Message #15 Posted by Dave Shaffer on 28 May 2002, 9:45 p.m.,in response to message #14 by Steve (Australia) With the a+b+c = 180 degrees condition, things are trivial. Recall Steve's initial fact: tan(a+b) = (tan a + tan b)/(1 - (tan a)*(tan b)) which can be looked up in your favorite book of trig identities. Note, also, that tan(-a) = -tan a . Then, with the 180 degree condition, we need to determine whether tan a + tan b + tan(180-a-b) = (tan a)*(tan b)*tan(180-a-b) Note, also, that tan(180-x) = -tan x (which can be derived from the sum formula above, realizing that tan 180 = 0). Then we get tan(180-a-b) = -tan(a+b) This relation greatly simplifies our task! To keep from typing "tan" all over the place, I let tan a = a, tan b = b, and tan c = c everywhere below. Since only tangents appear, there is no loss of meaning. Then, our expression to check becomes (with the 180 degree identity included, which puts in some minus signs): a + b - tan(a+b) =? -a * b * tan(a+b) where tan(a+b) has its normal meaning (i.e. NOT tan(tan a + tan b)) !! Now, expand tan(a+b) to get a + b - [(a + b)/(1-ab)] =? -a * b * [(a + b)/(1-ab)] where a, b, c now all mean their respective tangents. Multiply this expression through by the (1-ab) denominator to get (1-ab)(a+b) - a - b =? -a * b * (a+b) This becomes a + b - aab - abb -a - b =? -aab - abb where I have elected to write aa (and bb) instead of a^2 (a-squared) for a times a. The a and b terms cancel on the left side, leaving us with an identity: -aab -abb = -aab -abb So, indeed, if the sum of the angles equals 180 degrees, the sum and product of the three tangent terms ARE EQUAL. QED Next challenge?!

 I think we're off on a tangentMessage #16 Posted by Steve (Australia) on 29 May 2002, 8:10 p.m.,in response to message #15 by Dave Shaffer *groan* ```> So, indeed, if the sum of the angles equals 180 degrees, > the sum and product of the three tangent terms ARE EQUAL. > > QED ``` If the sum of the angles is a multiple of 180 But what of the case where one of the angles is 90 or 270 (-90, 450, ...)??? You will be asking for a tan at one of the points where the result is undefined. Is the relationship still valid at these points? Are the infinities equal?

 Final remarksMessage #17 Posted by Ex-PPC member on 30 May 2002, 12:33 p.m.,in response to message #1 by Ex-PPC member Thanks to all those people that posted and/or were interested in this thread, I think the issue has been made perfectly clear, just a few final remarks. First, the original challenge could have been presented like this: "What condition must a,b,c meet for us to have: Ln(a + b + c) = Ln(a) + Ln(b) + Ln(c) ?" where, weirdly enough, the log of the sum is equal to the sum of the logs !. The required condition can be expressed of course, as arctan(a) + arctan(b) + arctan(c) = Pi which is quite astonishing at first, making a seemingly logarithmic expression depend on a trigonometric identity involving the number Pi. Second, as a corollary of this fact, we have the beautiful identity: Pi = arctan(1) + arctan(2) + arctan(3) which is just a particular case. You just need to realize that 1 + 2 + 3 = 1 * 2 * 3 ( = 6) to demonstrate it. Third, I would love to know if the symbolic math capabilities of the HP48/49 can cope or help with this kind of unusual trigonometric identities. Can some dedicated and loving HP49 user tell us ? Next S & S Math Challenge soon, stay tuned ! :-)

 Re: Final remarksMessage #18 Posted by Andrés C. Rodríguez (Argentina) on 1 June 2002, 10:57 a.m.,in response to message #17 by Ex-PPC member Thank you, Mr. Ex-PPC (would you ever reveal your identity?), for an enlightening challenge and the "bonus track" with the final remarks!! Please keep such challenges coming!!

Go back to the main exhibit hall