Contents

Computation of the Reciprocal of an Irrational Number


Computations with irrational numbers

1/(2^(1/2) + 3^(1/2));
				 1
(%o15)			 -----------------
			 sqrt(3) + sqrt(2)

This is a number in the field Q[sqrt(2), sqrt(3)]. It has a representation in the form

  a + b*sqrt(2) + c*sqrt(3) + d*sqrt(2)*sqrt(3)

with unique rational coefficients a, b, c, d. To find this representation, we can do this:

 ev (ratdisrep(rat(%)), algebraic);

And we get this result:

   sqrt(3) - sqrt(2)

Here is a more complicated example that computes in Q[sqrt(2), 3^(1/3)]:

 ir2: 2^(1/2) + 3^(1/3);
			   1/3
(%o20)			  3    + sqrt(2)
 1/ir2;
				1
(%o26)			  --------------
			   1/3
			  3    + sqrt(2)
 ev (ratdisrep(rat(%)), algebraic);
					     2/3		    1/3
(%o27)			    (3 - 2 sqrt(2)) 3    + (4 - 3 sqrt(2)) 3    - 4 sqrt(2) + 6
 %*ir2;
			    1/3				     2/3		    1/3
(%o28)			  (3    + sqrt(2)) ((3 - 2 sqrt(2)) 3    + (4 - 3 sqrt(2)) 3    - 4 sqrt(2) + 6)
expand(%);
   1

The third example is even more complicated. We use a nested root to extend the field Q:

r: 33^(1/2)*3;
     3 sqrt(33)

With this root, we define two third roots:

r1: (17 - r)^(1/3);
					      1/3
(%o2)			     (17 - 3 sqrt(33))
r2: (17 + r)^(1/3);
					      1/3
(%o3)			     (3 sqrt(33) + 17)

With these roots we can now write the number that we want to invert:

rn: r1+r2;
				   1/3			  1/3
(%o8)		  (3 sqrt(33) + 17)    + (17 - 3 sqrt(33))

The reciprocal is:

 1/rn;
				       1
(%o9)		  -------------------------------------------
				   1/3			  1/3
		  (3 sqrt(33) + 17)    + (17 - 3 sqrt(33))
ev (ratdisrep(rat(%)), algebraic);

We obtain:

			2/3		       1/3		    1/3
(%o10)((3 sqrt(33) + 17)    - (17 - 3 sqrt(33))	   (3 sqrt(33) + 17)

									2/3
						     + (17 - 3 sqrt(33))   )/34

This product is simplified with rootscontract:

rootscontract(%);
							   2/3			  2/3
					  (3 sqrt(33) + 17)    + (17 - 3 sqrt(33))    + 2
(%o11)					  -----------------------------------------------
								34

This is the searched reciprocal in the desired representation.

Multiplication with rn gives:

%*rn;
				    1/3			   1/3			  2/3			 2/3
		  ((3 sqrt(33) + 17)    + (17 - 3 sqrt(33))   ) ((3 sqrt(33) + 17)    + (17 - 3 sqrt(33))    + 2)
(%o12)		  -----------------------------------------------------------------------------------------------
								34

To continue our computation, we expand this:

expand(%);
		       1/3		    2/3			   2/3		        1/3		       1/3
      (17 - 3 sqrt(33))	   (3 sqrt(33) + 17)	  (17 - 3 sqrt(33))    (3 sqrt(33) + 17)      (3 sqrt(33) + 17)
(%o22)----------------------------------------- + ----------------------------------------- + --------------------
			 34					     34				       17

															    1/3
													   (17 - 3 sqrt(33))
													 + -------------------- + 1
														    17

The product of the roots is removed with rootscontract:

rootscontract(%);
				   1/3			  1/3			 1/3			    1/3
		(24 sqrt(33) - 136)	 (3 sqrt(33) + 17)      (17 - 3 sqrt(33))      (- 24 sqrt(33) - 136)
(%o24)	        ---------------------- + -------------------- + -------------------- + ------------------------ + 1
			  34			  17			 17			  34
													    17

To simplify this, we canonicalize this expression with the option radexpand:all. This option transforms (24*SQRT(33) - 136) into 2*(3*SQRT(33) - 17).

radcan(%), radexpand:all;
  1

It is convenient to define a function that computes the reciprocal and performs all desired simplifications:

inv(x) := block([r:1/x], rootscontract(ev (ratdisrep(rat(r)), algebraic)));

We can now write:

inv(r1 + r2);

to obtain:

				 2/3		        2/3
		(3 sqrt(33) + 17)    + (17 - 3 sqrt(33))    + 2
(%o5)	        -----------------------------------------------
				      34


Contents