Quartz is formed through crystallization from magma (molten rock) or lava, or through precipitation from water solutions.
Here's a breakdown:
* Magmatic/Igneous Quartz: Quartz crystallizes directly from cooling magma or lava.
* Hydrothermal Quartz: Quartz forms from hot, mineral-rich water solutions.
* Sedimentary Quartz: Quartz can also be found in sedimentary rocks formed from weathered and eroded rocks. However, the original quartz crystals themselves weren't formed within the sedimentary rock; they were simply transported and deposited there.
So, while quartz can be found in different types of rocks, it's not formed *from* them. It's a fundamental component of many rocks, but it forms through its own processes.