Take a small area #dA# of width #l# and thickness #dy# parallel to the #x-"axis"# and
The momemt of inertia is
#dI_x=y^2dA#
#dA=ldy#
From similar triangles
#l/L=(h-y)/h#
#l=(h-y)L/h#
So,
#dI_x=y^2ldy=(h-y)L/hy^2dy#
#dI_x=L/h(hy^2-y^3)dy#
Integrating both sides
#I_x=L/hint_0^h(hy^2-y^3)dy#
#=L/h[hy^3/3-y^4/4]_0^h#
#=L/h(h^4/3-h^4/4)#
#=L/h*h^4/12#
#=(Lh^3)/12#
#"CORRECTION"#
The area of the triangle is #A=1/2Lh#
The mass of the triangle is #=M#
The density of the material is #rho=M/(1/2Lh)=(2M)/(Lh)#
The area #dA=ldy#
The mass is #dm=rholdy=(2M)/(Lh)*(h-y)L/hdy#
#dm=(2M)/h^2(h-y)dy=((2M)/h-(2M)/h^2y)dy#
The moment of inertia is
#dI_x=y^2dm=((2M)/h-(2M)/h^2y)y^2dy#
#dI_x=((2M)/hy^2-(2M)/h^2y^3)dy#
Integrating
#I_x=int_0^h((2M)/hy^2-(2M)/h^2y^3)dy#
#= [ 2M)/hy^3/3-(2M)/h^2y^4/4]_0^h#
#=(2/3Mh^2-1/2Mh^2)#
#=1/6Mh^2#