September 30, 2020 compared to $265,000 in the six months ended September 30, 2021. Cost of revenues included stock-based compensation expense of $84,000 and $64,000 for the three months September 30, 2020 and 2021, respectively, and $172,000 and $134,000 for the six months ended September 30, 2020 and 2021, respectively.
Gross Profit. Gross profit increased by 34.2% from $3.1 million in the three months ended September 30, 2020 to $4.2 million in the three months ended September 30, 2021 and by 45.4% from $6.2 million in the six months ended September 30, 2020 to $9.0 million in the six months ended September 30, 2021. Gross margin increased from 46.7% in the three months ended September 30, 2020 to 53.6% in the three months ended September 30, 2021 and increased from 46.4% in the six months ended September 30, 2020 to 54.0% in the six months ended September 30, 2021. The changes in gross profit are primarily related to the change in net revenues discussed above. The changes in gross margin are primarily related to changes in the mix of products and customers.
Research and Development Expenses. Research and development expenses increased by 4.4% from $5.7 million in the three months ended September 30, 2020 to $5.9 million in the three months ended September 30, 2021. The increase in research and development spending was primarily related to an increase of $366,000 in payroll related expenses and lesser increases in stock-based compensaton expense and facilities related expenses partially offset by lesser decreases outside consulting expenses and other fees and patent related legal fees. Research and development expenses included stock-based compensation expense of $353,000 and $418,000 for the three months ended September 30, 2020 and 2021, respectively. Research and development expenses increased by 4.6% from $11.5 million in the six months ended September 30, 2020 to $12.0 million in the six months ended September 30, 2021. The increase in research and development spending was primarily related to an increase of $718,000 in payroll related expenses and lesser increases in stock-based compensaton expense and facilities related expenses partially offset by lesser decreases outside consulting expenses and other fees and patent related legal fees. Research and development expenses included stock-based compensation expense of $766,000 and $888,000 for the six months ended September 30, 2020 and 2021, respectively.
Selling, General and Administrative Expenses. Selling, general and administrative expenses increased by 6.9% from $2.6 million in the three months ended September 30, 2020 to $2.8 million in the three months ended September 30, 2021. An increase of $62,000 for professional fees and lesser increases in payroll related expenses, general insurance expense, stock-based compensation expense and independent sales representatives commissions was partially offset by a decrease in travel related expenses. Selling, general and administrative expenses included stock-based compensation expense of $216,000 and $234,000 for the three months ended September 30, 2020 and 2021, respectively. Selling, general and administrative expenses increased by 5.4% from $5.5 million in the six months ended September 30, 2020 to $5.8 million in the six months ended September 30, 2021. An increase of $137,000 in independent sales representatives commissions and lesser increases in professional fees, general insurance expense and stock-based compensation expense was partially offset by a decrease in travel related expenses. Selling, general and administrative expenses included stock-based compensation expense of $470,000 and $517,000 for the six months ended September 30, 2020 and 2021, respectively.
Interest Income and Other Income, Net. Interest and other income, net decreased by $8,000 from a net expense of $16,000 in the three months ended September 30, 2020 to an expense of $8,000 in the three months ended September 30, 2021. Interest income decreased by $62,000 primarily due to lower interest rates received on our cash and short-term and long-term investments and a lesser amount of investments. Foreign exchange losses were $96,000 for the three months ended September 30, 2020 compared to $26,000 for the three months ended September 30, 2021. Interest and other income, net decreased by $118,000 from income of $90,000 in the six months ended September 30, 2020 to an expense of $28,000 in the six months ended September 30, 2021. Interest income decreased by $153,000 primarily due to lower interest rates received on our cash and short-term and long-term investments and a lesser amount of investments. Foreign exchange losses were $104,000 for the six months ended September 30, 2020 compared to $69,000 for the six months ended September 30, 2021. The exchange losses in each period were related to our Taiwan branch operations and our operations in Israel.
Provision (benefit) for Income Taxes. The provision (benefit) for income taxes decreased from a provision of $62,000 in the three months ended September 30, 2020 to $42,000 in the three months September 30, 2021 and decreased from a provision of $549,000 in the six months ended September 30, 2020 to a benefit of ($130,000) in the six months September 30, 2021. The provision for (benefit from) income taxes for the three months ended