# How to draw right angled triangle with a, b and c lengths shown?

I'm trying to draw a right angled triangle with hypotenuse length 1,opposite length b and adjacent length c in Mathematica. How do I do this? I'm trying to draw an isosceles triangle showing length 1 for hypotenuse and side a and side b for other sides.

• So a 45,45,90 triangle, and you want the hypotenuse labeled "1", one side labeled "b", and one side labeled "c"? Is this what you're after? – user6014 Aug 29 '18 at 1:05
• That is what I want. Please – Matthew Reading Aug 29 '18 at 1:07
• Perhaps you want to look up Graphics, Line and Text. Using just these three commands you can draw all kinds of illustrations and add labels. If you already have something, just share it with us and we can help you more easily. – Johu Aug 29 '18 at 1:11
• SSSTriangle generates lengths 3 4 5 but not 1,a, and b. – Matthew Reading Aug 29 '18 at 1:13
• b=.3;Graphics[SSSTriangle[1,b,Sqrt[1-b^2] ]]? – kglr Aug 29 '18 at 1:17

Here's a suggestion for a function which takes arbitrary x and y lengths, and plots a right triangle with those values. Adjust the styling/options as desired.

plotTriangle[x_, y_] :=
Graphics[{Red, Thick,
Line /@ {{{0, 0}, {x, 0}}, {{0, 0}, {0, y}}, {{x, 0}, {0, y}}}},
Axes -> True,
Epilog -> {Inset[Style["a", 20, Red], {x/2, 0 + y/15}],
Inset[Style["b", 20, Red], {x/15, y/2}],
Inset[Style["1", 20, Red], {x/2 + x/15, y/2 + y/15}]}] • Why do you prefer to use Epilog instead of Text or Inset in the first argument of Graphics? – Johu Aug 29 '18 at 1:15
• You can use whatever you want. This is just what I chose in this instance. – user6014 Aug 29 '18 at 1:15
• I tried the code you suggested and pressed shift enter and the graph didn't show. How do I get the graph to show? – Matthew Reading Aug 29 '18 at 1:16
• It's a function definition. Plug values into the function. Like plotTriangle[2,2] – user6014 Aug 29 '18 at 1:17
• Sorry I missed plotTriangle[4,5]. – Matthew Reading Aug 29 '18 at 1:19

You can also post-process the diagram produced by LaminaData["Filled345Triangle" , "BoundaryDiagram"] to get a diagram labeled as desired:

text = {"b", "c", 1};
i = 1; Replace[LaminaData["Filled345Triangle" , "BoundaryDiagram"] ,
{p : Polygon[{{0, 0}, __}] :> {LightBlue, p}, Text[_, p_] :> Text[text[[i++]], p]}, ∞] 