When I have pink eye, is it infectious even when it just formed?

Yes. Pink eye is very contagious. It tends to jump to the other eye and to other people who you come in contact with. We touch our eyes then other objects a lot and the lacrimal duct drains into the nasopharynx so it tends to spread with any cough or sneeze. I'm not sure of this, but i suspect it takes a day or two from being infected to being visible, so you had it longer than you think.
Pink eye. Pink eye is often caused by a virus, and therefore can be contagious. The only way to know for sure is to see your doctor. You should take precautions until you know for sure that you are not contagious.