You ask two different questions. Let me ask each separately (based on my own experience which coincides with yours).
Why do I always sound better when I play violin with my teacher?
One skill in violin playing is pitch. There are no frets on the violin's fingerboard and so: we choose the pitch of the note. So for us violinists intonation (pitching) is a skill. Many say that good intonation comes from inside the violinist, which is true, but it really helps to have a reference pitch to work from. Try playing a scale while someone drones the key note on a pitched instrument - it really keeps your own intonation solid. The same happens when I play with my teacher. As we play I unconsciously and instantaneously correct my intonation to match hers.
We can make a similar argument for rhythm.
I notice that during lessons, I pay a lot better than when I practice at home. Even if my teacher asks me to play something by myself, it sounds better than when I try to play the same thing at home. Does anyone know why this happens?
I have twothe opposite experience. I often think that I have played something better at home. I practise and practise and am excited to let my teacher hear how great it sounds, and then it sounds awful :-(
I have three theories about this one. (N.B. I know this is the opposite of what you ask but differing contradictory experiences may be interesting.)
- I am very comfortable with my teacher - we have been working on my playing together for almost ten years. But even so I am more relaxed at home, especially on my own. Nervousness can be useful - it gives you an excitement to transfer into your performance, but it can also hamper your technique.
- I am less critical of my own playing at home. I get into it and fail to notice that I'm slowing down at the difficult passages, that my bowing has gone out the window, that my intonation has gone wobbly, etc. When playing with my teacher her comments (or even just her facial expressions!) bring all of that accurate critique back to me.
- Sometimes I will play the piece alone in my lesson after my teacher and I have already played it together. Often (always?) my teacher establishes a faster and more consistent tempo than I have been allowing myself at home and thus when I play alone at this faster tempo my technique suffers.