I have recently begun working on 3d mathematics and I am pretty decent with matrices but I still dont see how having a 4x4 matrix can represent something for 3d graphics programming for a C++ program, could anyone explain this or give an example please. Thanks in advance

Sometimes Google really does help. I typed "representing space using 4x4 matrix" into the search box and came up with a bunch of interesting sites, if you like math. The best summary I found doing a rapid scan of several sites was:

Using a 4 x 4 transformation matrix allows you to combine rotations, translations, scales, shears, and reflections in a single matrix in addition to using permitting perspective and viewing projections.

Give it a try. You might amaze yourself.