“the house of David.” Ahaz was of the line of David. The Davidic dynasty and the “throne of David” continued from David until Jehoiachin died in the Babylonian Captivity. It is not clear why the text uses “the house of David” here; it may be because God promised David that his house (dynasty) would continue forever, and had Ahaz repented and turned to God and caused Judah to do the same that God would have protected Judah like He did during the reign of Hezekiah (2 Kings 19:35-37).
“his heart trembled.” This is referring to the king of Judah, Ahaz. There is good reason Ahaz’s heart—and also the hearts of the people of Israel—trembled when he heard that Syria was allied with “Ephraim” (Israel). At this point in history, Israel and Syria were both larger nations than Ahaz’s country of Judah, and the fact that they had allied themselves against him ostensibly mean his doom and the end of Judah. In fact, Syria and Israel were so confident of victory in a war that they had already picked a person to be the new king of Judah, the son of Tabeel (or “Ben-tabeel”). Furthermore, besides having Syria and Israel as enemies, Judah was also being attacked by the Edomites from the south and the Philistines from the west (2 Chron. 28:17-18). The book of 2 Chronicles gives the real reason for Judah’s troubles at this time, and it was Ahaz’s rejection of Yahweh and His laws (2 Chron. 28:19).
“Ephraim” was the most prominent and powerful tribe in the nation of “Israel,” so in this context, “Ephraim” stands for the whole country of Israel. Technically, this is the figure of speech synecdoche of the part, when a part is put for the whole. Ephraim was often put for the country of Israel although at other times Ephraim had more of the connotation of Samaria, the capital of Israel because that was where the king lived and thus it was the center of corruption and idolatry (cp. Isa. 7:2, 5, 8; 11:13; 17:3; Jer. 7:15; 31:9; Hos. 6:4; Zech. 9:10). Also, although technically the city of Samaria was in the tribal area of Manasseh, the fact that Ephraim and Manasseh were both “the tribe of Joseph” (Deut. 33:13; Josh. 17:14-18; 18:5; Judg. 1:22), the fact that the exact boundaries between the tribes were often ignored, and the prominence of Ephraim such that often all Israel was called “Ephraim,” led to the city of Samaria being referred to as being part of Ephraim (cp. Isa. 7:9).