When the triangles are drawn in an octagon with vertices same as those of the octagon and having one side common to that of the octagon, the figure will appear as shown in (Fig. 1).

Now, we shall first consider the triangles having only one side AB common with octagon ABCDEFGH and having vertices common with the octagon (See Fig. 2).Such triangles are ABD, ABE, ABF and ABG i.e. 4 in number.

Similarly, the triangles having only one side BC common with the octagon and also having vertices common with the octagon are BCE, BCF, BCG and BCH (as shown in Fig. 3). i.e. There are 4 such triangles.

This way, we have 4 triangles for each side of the octagon. Thus, there are 8 x 4 = 32 such triangles.