  A two-dimensional quadrupole topological insulator on a square lattice is a
typical example of a higher-order topological insulator. It hosts an edge state
localized near each of its $90^{\circ}$ corners at an energy $E$ inside the
band gap, where $E$ is set equal to zero for simplicity. Although the
appearance of an edge state has been shown in simple systems with only
$90^{\circ}$ corners, it is uncertain whether a similar localized state can
appear at $E = 0$ near a complicated edge consisting of multiple $90^{\circ}$
and $270^{\circ}$ corners. Here, we present a numerical method to determine the
wavefunction of a zero-energy state localized near an arbitrary edge. This
method enables us to show that one localized state appears at $E = 0$ if the
edge consists of an odd number of corners. In contrast, the energy of localized
states inevitably deviates from $E = 0$ if the edge includes an even number of
corners.
