Z Matrix can be formed by either inverting the Ybus matrix or by using Z bus building algorithm. The latter method is harder to implement but more practical and faster (in terms of computer run time and number of floating-point operations per second) for a relatively large system.
Formulation:

Because the Zbus is the inverse of the Ybus, it is symmetrical like the Ybus. The diagonal elements of the Zbus are referred to as driving-point impedances of the buses and the off-diagonal elements are called transfer impedances.[1]
One reason the Ybus is so much more popular in calculation is the matrix becomes sparse for large systems; that is, many elements go to zero as the admittance between two far away buses is very small. In the Zbus, however, the impedance between two far away buses becomes very large, so there are no zero elements, making computation much harder.
The operations to modify an existing Zbus are straightforward, and outlined in Table 1.
To create a Zbus matrix from scratch, we
start by listing the equation for one branch:
![{\displaystyle [V_{1}]=[Z_{a}][I_{1}]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/66138c7cd809fdcbd954f101a6ab76bff22ff773)
Then we add additional branches according
to Table 1 until each bus is expressed in the matrix:
