Saturday, June 21, 2014

Gate Brace Math

Sooner or later, a homestead will need a gate.  Or a door on something.  Or some other swinging rectangle.  It's inevitable.  The part that swings is usually constructed by building a rectangular frame with a diagonal cross piece for stabilization and support, and then covered with boards or pickets, or whatever.  The dimensions of the perpendicular pieces are fairly straightforward, but what about the diagonal brace?  What size should that be and what angles should it have?  Many folks just lay a board across the frame, mark where the edges should be, and cut along a line between the marks.  But what if the frame is slightly out-of-square when the board is set on it?  What if you're building with old warped wood (or twisty-turny, cool-looking logs) and the brace won't sit right on the frame?  Wouldn't be nice if there were a way to calculate what the dimensions should be?  Fortunately, there is!  Time to pull out some triangle math and get measurin'.

The first step is to decide on the dimensions of the gate.  Once you know the height and width, and thickness of the wood (or other material) you're going to build it with, you can build the frame, minus the crosspiece.  Then decide what type of diagonal brace you want.

Three common choices are the trapezoid (left), the parallelogram (middle), or the 'skinny hexagon' (right).  As a side note, the brace should be positioned with the bottom on the side with the hinges (i.e., in the figure, the hinges should be on the left side of each gate).  That way, the weight of the gate compresses down on the brace, which gives more support than nails and screws can provide on their own, and helps mitigate sagging over time.

Now it's time to do math! Yay!  Fortunately, we can get all the dimensions we need with just three equations: the Pythagorean theorem, SOH CAH TOA, and the law of sines, since we know the inner dimensions of the gate frame and the thickness of the wood we're planning to use for the brace (e.g., 1.5" for the thin side of a 2 x 4).

Case 1: Trapezoid brace.  Easy peasy.  The length of the brace is the hypotenuse of the frame, z, which we calculate from the Pythagorean theorem, with L1 and L2 as the side lengths.  The angle Θ1 is the arctan of L2/L1.  The angle Θ2, which is the angle to cut the board at, is calculated by subtracting Θ1 from 90°.  The length, d, is the quotient of the brace board width, w, and tan Θ2.  The length d is often the most useful measure since we can measure down d from one corner, draw a line to cut along from there to the opposite corner (on the same end of the board), and the angles and other dimensions will take care of themselves.  As a check that everything's kosher, x and y can be calculated as shown.  Note: similar, but not the same, equations apply at the opposite end of the brace.  There, tan Θ1 = w/d.

Case 2: Parallelogram brace.  Probably the most common, but also the most math-intensive to figure out.  The hypotenuse of the gate frame, z, is now the long diagonal of the parallelogram. The angle between z and L1 is Θ1; the angle between y and L1 (the angle at which to cut the board), is Θ2. z and Θ1are calculated as in Case 1 above.  Next, the SOH part of SOH CAH TOA means there are alternate equations for Θ1 and Θ2; namely using L2, w, x, and y, which will be helpful in the next step.  For the triangle with x, y, and z as sides, we can use the law of sines, substituting for y and sin Θ1, to find the difference between Θ1 and Θ2, and from there, Θ2;.  Once Θ2 is known, substituting back into the equations from SOH makes for easy calculation of x and y, and since d is one side of a right triangle with w and x as the other sides, we can use the Pythagorean theorem to calculate d, which is what we really wanted in the first place.  Phew!  One advantage to this design is that it's possible to use a slightly shorter board (by, like, fractions of an inch) since the hypotenuse of the frame is the diagonal of the board instead of the length.  But if you've got a piece of scrap 2 x 4 that's a quarter of an inch too short for the other brace designs...

Case 3: Skinny hexagon brace.  This one is kind of like Case 1, with two trapezoids back to back.  The hypotenuse of the frame lies along the centerline of the board, which means that to calculate d1 and d2 we can use the tangents of Θ1 and Θ2, which are the ratios of the sides and also of half the brace board width and one of the d's, as shown.  As a check, x1, x2, and y can be calculated from the Pythagorean theorem and the SOH or CAH parts of the right triangle with (L2 - x2), (L1 - x1), and y as sides, respectively.

With the equations above, it's possible to make perfectly-fitting braces every time on gates, doors, and lots of other swinging rectangles around the homestead. (Within the experimental error of the craftsman's skills, of course).  Clearly, the chickens appreciate the extra effort, since they're always crowding into the door frame when the chicken tractor door opens.  They're probably eager for a chance to admire the gate brace from a new angle, and not at all excited that they suddenly have more space around the feeder.

We've also compiled this information into a handy Excel-based calculator, free for download here.  Let us know if you have any suggestions to improve it!

How do you size the diagonal braces for your gates, etc.?  What was the last thing you attached a gate to?  Let us know in the comments section below!


  1. If you don't have a calculator, and you need a quick way to square a rectangle, just remember 3-4-5. 3Sq+4Sq=5Sq so if you have a 3 foot board, and a 4 foot board (usable gate sizes) Square it up with a 5 foot board. (keeping in mind inside and outside dimensions)

  2. Or just use a framing square ... Math is fun but getting a job done quickly is much more fun

    1. I suppose with all the time you save, you could do math!

      But you're right, there are tools to make the job go quickly so you can move on to the next project. There's definitely no shortage of work to go around!

  3. Or just use a framing square ... For a gate that's all you really need

  4. In case 2, how do we know that

    angle X = theta2 - theta1 ?

    1. The sides of the brace are parallel and the diagonal z transverses them, so the alternate interior angles are congruent.

      In the picture inset, you can see the alternate interior angle of X; think of drawing theta2 downward from the opposite side of the brace (i.e., across the brace), and hopefully it will be easier to visualize!

  5. That's nice and clear, thanks. Shame your sheet seems to have gone missing in the meantime. Could you repost/update it?

  6. Hi,

    I am making a wire gate with a wooden (2x2) frame. The gate does not have two halves that swing separately, but it will have a horizontal cross-member halfway up. It will also have a diagonal brace from a top corner to the midpoint of the opposite vertical, and a diagonal brace from a bottom corner to the midpoint of the opposite vertical (both diagonals meet the middle horizontal member).

    My question is: should the top diagonals be parallel, or "oppose" one another? I am wondering how to correctly analyze the forces at play. I remember doing force vector diagrams in physics classes to describe situations like this, but can't remember quite how to go about it. Intuitively, I think they should not be parallel, but the few photos of examples of this gate construction have shown parallel diagonal braces. I think they should oppose because they will meet at the same end of the middle horizontal. If the vertical part of the force vector along the lower diagonal pushes up on the end of the middle horizontal member, and the the vertical part of the force vector along the upper diagonal pushes down on the SAME end of the middle horizontal member, it would seem to me that they cancel one another in a very stable way. Whereas if the two diagonals are parallel, the lower diagonal will push up on one end and the upper diagonal will push down on the the OPPOSITE end of the middle horizontal member, potentially inducing it to rotate, make it much less stable. That is where my intuition stems from, but I don't know if it is mathematically complete, especially as it does not consider the outside forces on the door.

    I have also read that a diagonal brace should start at the top corner opposite the hinges (as in your example photo). I wonder why this is? The answer to this question might help with understanding how to apply the external forces on the the diagonals to analyze whether parallel or opposing is better.

    Lastly, it would be interesting to go into a similar comparison of the effectiveness/stability/stiffness of the three choices of brace that you talk about...


    1. Hmm...this is a tricky one. The force in play is gravity acting downward on the gate, but with torque around the hinges, particularly the bottom hinge.

      Because of the hinges holding one side in place, gravity tends to deform the gate from a rectangle into a parallelogram with the upper hinge side and the lower outside forming the long axis. Because of this, the general recommendation is, as you say, to have the diagonal brace low on the hinge side so gravity puts the brace in compression. Having the diagonal high on the hinge side would put the diagonal in tension such that the screws/nails are the only thing keeping the gate from deforming.

      On your gate, however, the bottom brace, being low on the hinge side, will be in compression no matter what the orientation of the top brace is.

      The way I tend to think about it, though I'm not sure if it's completely correct conceptually, is that for a hinge side-low brace, the weight of the gate above the brace (i.e., what gravity is trying to use to deform the gate) will be transferred toward the hinge side of the gate through the brace (minimizing torque at the hinge), whereas for a hinge side-high brace, the weight of the gate above the brace doesn't get transferred much to the hinge side because the brace is close to parallel with the direction of torque.

      So for your gate, making the upper brace parallel to the lower brace would transfer a small amount of the gate's weight toward the hinge side at the middle. Transferring weight from the upper outside corner to the middle of the hinge side might reduce the effective torque at the lower hinge some, but because you've still got the bottom diagonal in compression, the overall difference in stabilization is probably minimal.

      Also, I wouldn't be worried too much about the middle horizontal member rotating out of square with parallel braces, because the bottom brace isn't really pushing it "up" on the outside--the outer part of the gate is pulling it downward and it's resisting. (Consider what would happen if the gate did get deformed into a parallelogram--the middle horizontal member would start to angle downward on the outside and be put in tension.) If anything, a parallel upper brace could help stabilize the horizontal piece a little.

      One other thing, (this reply is already way too long, so what's one more paragraph?): for doors that are hung from the top instead of hinged at the side (e.g., sliding barn doors), perpendicular upper and lower braces are more common, since there aren't any compressive-tensile advantages to be had from gravity and the horizontal axis of symmetry looks nicer. :-)

      An analysis of the stabilizing effects of the different brace types would be interesting. I also haven't drawn a free body diagram since undergrad physics classes, but I do still have my textbook...and an architect friend I should catch up with. Hmm...

  7. Do you happen to have an updated link for the Excel-based calculator that you mentioned?

  8. Thanks for the formulas, but I think I'm missing an equation in Case 2. How can you calculate theta2 without knowing x and y?

    1. In the third-to-last line, x and L2 cancel, so you're left with an equation to solve for (theta2 - theta1) using only w and z. Theta1 you get from the second line. Then, once you know theta1 and (theta2 - theta1), theta2 is just the sum of those two angles. To get x and y, you can go back and substitute in the equations on the third line.

  9. I'm having a hard time understanding how to get 02 I got 01 but for 02 I don't know x. Sin02 = 1.5" / x

    My 3 knows legnths Are L2= 20.5625 L1 =14.25 z=25.02 w= 1.5"

    I figured out 01 using sin01 = L2 / z

    How do i get my cut angle of 02

    Can you write it out?