There are two disjoint circles. Their centers and radii are given. Without doing extra calculations, can we draw the 4 tangent lines using PSTricks (preferred) or others?

I asked many Illustrator, Free-hand, CAD experts, they cannot do it exactly. :-)

  • 2
    What do you mean by "without doing extra calculations"? Dec 16, 2010 at 9:05
  • @Yossi, without doing extra calculation means we don't need to do trigonometric calculations. I think you know what I mean. Dec 16, 2010 at 11:11
  • Actually, I'm really not sure...is the answer given by Andrew good or did you hope for something like the TikZ tangent option only that it can take two circles instead of a point and a circle? Dec 16, 2010 at 11:40
  • This can be done by rule and compass. Some GUI grograms, like GeoGebra, Geometer's Sketchpad can draw such Euclidian geometry graphs easily.
    – Leo Liu
    Feb 1, 2011 at 16:11

4 Answers 4


pstricks-add knows a macro for calculating and saving 10 points as nodes, the two central points and the four points on each circle. See the documentation (run texdoc pstricks-add) for the names:

\usepackage{pstricks-add}% loads also pst-node



enter image description here

  • This is a solution with no extra calculations! +1 Very nice! Dec 17, 2010 at 15:37
  • 2
    Just out of curiosity: Did you just implement that feature/function? Two versions (that is 4 days - from ctan.org) back it did not exist. Dec 17, 2010 at 15:55
  • 1
    The solution in pst-eucl needs some understanding on how tangent lines are build. The tangents of two circles is the same as 2 times the tangents of a point and one circle. The macro \psCircleTangents from pstricks-add didn't need any understanding of the geometry behind the constructiong of the tangent lines. The package on texnik.dante.de are development versions and will be as soon as possible on CTAN when no problems are posted.
    – user2478
    Dec 17, 2010 at 18:20
  • 2
    from today it should be available by the TeXLive update manager. Read the documentation (run "texdoc pstricks-add") to see how the macro works for one circle and two circles.
    – user2478
    Dec 19, 2010 at 8:04
  • 1
    thanks. Indeed the documentation was written with hot needles ... I'll correct the typos
    – user2478
    Dec 19, 2010 at 20:13

TikZ can work out the tangent line between a circle and a point, so it's halfway there for this. With a tiny bit of mathematics, this can be bootstrapped to the tangent lines you want. The following code will do it (though it ought to check for the case where the two radii are the same - at the moment, that will produce an error, as will the situation where the circles overlap).

Here's the result:

Tangent lines

Here's the code:


\pgfmathsetmacro{\mid}{\rone/(\rone + \rtwo)}
\pgfmathsetmacro{\out}{\rone/(\rone - \rtwo)}
\node[draw,circle,minimum size=2 * \rone cm,inner sep=0pt] (c1) at (1,0) {};
\node[draw,circle,minimum size=2 * \rtwo cm,inner sep=0pt] (c2) at (-1,-6) {};
\path (c1.center) -- node[coordinate,pos=\mid] (mid) {} (c2.center);
\path (c1.center) -- node[coordinate,pos=\out] (out) {}  (c2.center);

%\draw[red] (tangent cs:node=c2,point={(mid)}) -- (tangent cs:node=c1,point={(mid)});
%\draw[red] (tangent cs:node=c2,point={(mid)},solution=2) -- (tangent cs:node=c1,point={(mid)},solution=2);

%\draw[red] (tangent cs:node=c2,point={(out)}) -- (tangent cs:node=c1,point={(out)});
%\draw[red] (tangent cs:node=c2,point={(out)},solution=2) -- (tangent cs:node=c1,point={(out)},solution=2);

\foreach \i in {1,2}
\foreach \j in {1,2}
\foreach \k in {mid,out}
\coordinate (t\i\j\k) at (tangent cs:node=c\i,point={(\k)},solution=\j);

\foreach \i in {1,2}
\foreach \k in {mid,out}
\draw[red] ($(t1\i\k)!-1cm!(t2\i\k)$) --  ($(t2\i\k)!-1cm!(t1\i\k)$);


The commented-out lines will draw the tangent lines to the exact points, I chose to extend them a little to show that they were genuinely tangent and that's what the code after the commented-out lines are for.

Despite being a mathematician, I didn't actually compute the formulae for the crossing points - I just guessed something that "felt right" and then tested it and it seems to work. However, I can't guarantee that it is right.

  • Fantastic...I was working on it myself...but you beat me to the punch! Dec 16, 2010 at 10:29
  • @Yossi: If you had a different implementation, you should still post it. Dec 16, 2010 at 10:31
  • cheers, it is not significantly different, and much less neat...I like your answer. don't worry.. Dec 16, 2010 at 10:33

The next version of tkz-euclide can draw the tangent lines. I created two macro for the internal similitude center of two circles and the external similitude center.


   \tkzDrawCircle[R](O,3 cm)
   \tkzDrawCircle[R](A,2 cm) 
   \tkzIntSimilitudeCenter(O,3)(A,2) \tkzGetPoint{I}
   \tkzExtSimilitudeCenter(O,3)(A,2) \tkzGetPoint{J}
   \tkzTangent[from with R= I](O,3 cm)  \tkzGetPoints{D}{E} 
   \tkzTangent[from with R= I](A,2 cm)  \tkzGetPoints{D'}{E'}
   \tkzTangent[from  with R= J](O,3 cm) \tkzGetPoints{F}{G}
   \tkzTangent[from with R= J](A,2cm)   \tkzGetPoints{F'}{G'} 
   \tkzDrawSegments[color=red](I,D I,E I,D' I,E')   
   \tkzDrawSegments[color=blue](J,F J,G)


the code is very simple to get these centers:

%                    Internal Similitude center
\path[coordinate]  (barycentric cs:#1=#4,#3=#2) coordinate (tkzPointResult);
%                    External Similitude center
 \path[coordinate]  (barycentric cs:#1=-#4,#3=#2) coordinate (tkzPointResult);

Then we can get the tangents. The code will be upload in a few days on the ctan servers.

enter image description here

  • Thanks for this solution. I am learning PGF/Tikz now because of its better syntax and one-step compilation. Mar 10, 2011 at 1:08
  • @xport: I think it's a good experience. Andrew's solution is interesting too. My package will be updated in a few days beacause I have a lot of works on others packages. Mar 10, 2011 at 5:59

I saw this old problem showing up recently (because someone edited one of the answers of comments), and I felt like making a MetaPost solution of it. Here it is — a "rule-and-compass" solution.

Since there is no native macro in MetaPost giving the tangents of a circle through an external point, I've created my own, which I use to solve the general problem. The trick is to consider that the two circles are homothetic (thus similar) and to find the centers of the corresponding homotheties (when existing). This program takes into account the case where both circles share the same radius.

% parameters
numeric u; u = 1cm; % unit length;

% For drawing straight lines, not segments
vardef straight_line(expr A, B) =
A + 1.5u*unitvector(A-B) -- B + 1.5u*unitvector(B-A)

% Macro finding the point M of the circle such that (IM) is tangent to the   circle
% and such that the angle (IC, IM) is positive
vardef tangent_point_circle(expr I)(expr C, r) =
  save intersect, cercle; pair intersect; path cercle[];
  cercle1 = fullcircle rotated (angle(C-I)) scaled 2r shifted C; 
  cercle2 = fullcircle scaled (abs(C-I)) shifted (.5[C, I]);
  if cercle1 intersectiontimes cercle2 <> (-1, -1): 
    cercle1 intersectionpoint cercle2

% Macro taking care of the four tangents
def four_tangents_of_circles(expr C_a, r_a)(expr C_b, r_b) =

  save I, J, w, C, r, circle; clearxy;
  numeric r[]; pair I, J, C[], w[]; path circle[];
  C1=C_a; C2=C_b; r1=r_a; r2=r_b;

  for i=1,2:
    circle[i] = fullcircle scaled 2r[i] shifted C[i]; draw circle[i];

  % Creating two intermediate radii for finding the centers of the homothecies
  z1 = ((C1--C2) rotatedaround (C1,90)) intersectionpoint circle1; 
  w1 = z1 rotatedaround(C1, 180); 
  z2 = ((C2--C1) rotatedaround (C2, 90)) intersectionpoint circle2; 
  w2 = z2 rotatedaround(C2, 180); 

  if r1 + r2 < abs(C2-C1): % The circles must be distinct, otherwise nothing is done

    % First couple of tangents (intersection located between the circles)
    drawoptions(withcolor blue);
    I = whatever[w1, w2] = whatever[z1, z2];            
    pair S[], T[];
    for i=1,2:
      S[i] = tangent_point_circle(I)(C[i], r[i]); 
      T[i] = S[i] reflectedabout(C1, C2); 
    draw straight_line(S1, S2);
    draw straight_line(T1, T2);

    % Second couple of tangents (intersection located outside both circles)
    drawoptions(withcolor red);
    if r1<>r2:
      J = whatever[w1, z2] = whatever[w2, z1];  
      pair S[], T[];
      S1 = tangent_point_circle(J)(C1, r1);
      T1 = S1 reflectedabout(C1, C2);
      S2 = tangent_point_circle(J)(C2, r2); 
      T2 = S2 reflectedabout(C1, C2); 
      if r1 > r2:
        draw straight_line(J, S1); 
        draw straight_line(J, T1);
        draw straight_line(J, S2); 
        draw straight_line(J, T2);
    else: % (same radius)
      draw straight_line(z1, w2);
      draw straight_line(z2, w1);


% Two examples in two separated figures
  four_tangents_of_circles ((-u, 2u), 2u) ((3u, 3u), u);% illustration of the general case

  four_tangents_of_circles ((-u, 2u), 2u) ((5u, 2u), 2u);% two circles with same radius


general case

two circles with same radius

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .