that's a right triangle
remember, if the legs of a right triangle measure a and b and the hypootnuse is c then a²+b²=c²
so
hypotnuse is longest side, the one oposite the right angle
in this case, it is 5
one leg is 4
and the other one is red, let's call it x
so
x²+4²=5²
x²+16=25
minus 16 both sides
x²=9
sqrt both sides
x=3
the length of the red vertical edge is 3cm