To do this simply, (avoiding most math), here are the assumptions:

1.) Drawing is always as you've shown

2.) Green triangle can only go negative or to zero

3.) Gray triangle can only go positive or to zero

4.) The blue height is just the sum of the other two.

For simplicity, I'm assuming that the only shapes on the page are the three triangles. For even greater simplicity, assume that they were drawn in this order: green, gray, blue: that way, green will be shapesheet 1, gray #2, and blue #3. (If not, then, you need to go to View > Drawing Explorer > Foreground pages>shapes. Click a shape and it will be selected, and that tells you its shapesheet id.)

Open the blue triangle shapesheet. In the 1st section, Shape Transform, make the following entries:

1.) LocPinY => Height*1. Note, this will shift the triangle in the drawing, just re-position it to where it needs to be.

2.) Height => guard(sheet.1!height-sheet.2!height)

That's it. Close the shapesheet.

Now as you drag the green/gray triangle's height, the blue will follow.

Wapperdude