In music theory, I see that a triad is a chord built with three notes. Take Emaj in example; it is built with
E,G#,B. But why when we strum all the six strings of the guitar does the harmony still work?
There is of course nothing stopping you from playing any number of the notes in the full six string chord. You don't even have to play the fifth as just root and the third will already give a reasonably clear tonality.
It just gives the guitar a fuller, richer tone to play as many octaves as possible of the notes in the chord but as I say it does not always have to be the case.